From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA20814; Wed, 24 Apr 2002 15:35:04 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA20768 for ; Wed, 24 Apr 2002 15:35:03 +0200 (MET DST) Received: from hirsch.in-berlin.de (hirsch.in-berlin.de [192.109.42.6]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g3ODZ2P14609; Wed, 24 Apr 2002 15:35:03 +0200 (MET DST) Received: from hirsch.in-berlin.de (localhost [127.0.0.1]) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with ESMTP id g3ODZ2TL020152 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT); Wed, 24 Apr 2002 15:35:02 +0200 Received: (from uucp@localhost) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with UUCP id g3ODZ2uS020150; Wed, 24 Apr 2002 15:35:02 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: caml-list@inria.fr Received: from localhost (oliver@localhost) by first.in-berlin.de (8.7.6/8.7.3) with SMTP id PAA00883; Wed, 24 Apr 2002 15:25:11 +0200 Date: Wed, 24 Apr 2002 15:25:11 +0200 (MET DST) From: Oliver Bandel To: Alan Schmitt cc: caml-list@inria.fr Subject: Re: [Caml-list] Stack Overflow... (recursion in try-statement) In-Reply-To: <20020424045225.GD2828@alan-schm1p> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 choice. 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. 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