Browse thread
[Caml-list] Stack Overflow... (recursion in try-statement)
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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) |
On Wed, 24 Apr 2002, Alan Schmitt wrote: [...] > let rec traversedir dir = > try > let d = Unix.readdir dir in > d :: (traversedir dir) > with > | End_of_file -> [] > > (Disclaimer: I didn't test the code). The idea is you force the > evaluation of readdir before the recursive call. > > I also modified the [d] @ l into a d :: l, which seems to be the same > thing to me. Yes, I (should have) looked for "::" but used "@". I think it's not only "the same" (it's not the same, but the result is the same ;-)), but it's the better choice. Yes, I have to use "::", because I only want to add *one element* to a list and do not really want to concatenate two lists. 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