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: | John Prevost <visigoth@c...> |
| Subject: | Re: [Caml-list] Stack Overflow... (recursion in try-statement) |
>>>>> "ob" == Oliver Bandel <oliver@first.in-berlin.de> writes:
ob> It works with
ob> let rec traversedir dir = try ( traversedir dir @
ob> [Unix.readdir dir] ) with End_of_file -> [];;
ob> ...but I have to add the recursive traversing-call (if
ob> Unix.st_kind is a S_DIR, I have to open that dir and go into
ob> it too... so I may add the opendir/closedir-calls into the
ob> traversedir itself...)
ob> But I'm wondering if I better should have a list as an
ob> addtional parameter, on which I append with readdir.
ob> Any design-hints are welcome.
One gotcha is that try <tail-call> with ... blocks aren't tail
recursive. So if you do that, you'll have to organize the code
slightly differently to make your tail call work.
John.
-------------------
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