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: [Caml-list] Stack Overflow... (recursion in try-statement)
Hello,


why does an stack overflow-error occur here?

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


I have not tried it with very deep directories, so
I did not expect such an error...

What is the problem here?


This function is a predecessor of later directory-
traversing processing stuff:
With this function I try to traverse directories.
Later versions of it should be expanded, so that
I can give as parameters a filetype and a function,
which will be applied to all files of a special
filetype => and that recursively.

(e.g.: moving all regular files or renaming all directories
or similar things)

How can I do such recursively filesystem-traversing?
How can I handle such things without running into
stack-overflows?

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