Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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)

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


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: