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: 2002-04-23 (22:55)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] Stack Overflow... (recursion in try-statement)

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.


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