Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Stack Overflow... (recursion in try-statement)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] Stack Overflow... (recursion in try-statement)
Hi,

I have found a working version:


On Tue, 23 Apr 2002, Oliver Bandel wrote:

> Hello,
> 
> 
> why does an stack overflow-error occur here?
> 
> let rec traversedir dir =
>           try ( [Unix.readdir dir] @ traversedir dir ) with
>           End_of_file -> [];;
[...]


It works with

 let rec traversedir dir =
           try ( traversedir dir @ [Unix.readdir dir] ) with
           End_of_file -> [];;

...but I have to add the recursive traversing-call
(if Unix.st_kind is a S_DIR, I have to open that
 dir and go into it too... so I may add the
 opendir/closedir-calls into the traversedir itself...)

But I'm wondering if I better should have a list as
an addtional parameter, on which I append with readdir.

Any design-hints are welcome.


Ciao,
   Oliver

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners