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: 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

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.


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