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 MAA15229; Wed, 24 Apr 2002 12:45:47 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA15121 for caml-list@pauillac.inria.fr; Wed, 24 Apr 2002 12:45:46 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA04244 for ; Wed, 24 Apr 2002 01:20:37 +0200 (MET DST) Received: from laurelin.dementia.org ([208.167.88.73]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g3NNKav16391 for ; Wed, 24 Apr 2002 01:20:36 +0200 (MET DST) Received: (from jprevost@localhost) by laurelin.dementia.org (8.11.6/8.11.6) id g3NNPSx50406; Tue, 23 Apr 2002 19:25:28 -0400 (EDT) (envelope-from visigoth@cs.cmu.edu) X-Authentication-Warning: laurelin.dementia.org: jprevost set sender to visigoth@cs.cmu.edu using -f To: Oliver Bandel Cc: caml-list@inria.fr Subject: Re: [Caml-list] Stack Overflow... (recursion in try-statement) References: From: John Prevost Date: 23 Apr 2002 19:25:27 -0400 In-Reply-To: Message-ID: <86lmbeuheg.fsf@laurelin.dementia.org> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >>>>> "ob" == Oliver Bandel writes: ob> It works with ob> let rec traversedir dir = try ( traversedir dir @ ob> [Unix.readdir dir] ) with End_of_file -> [];; ob> ...but I have to add the recursive traversing-call (if ob> Unix.st_kind is a S_DIR, I have to open that dir and go into ob> it too... so I may add the opendir/closedir-calls into the ob> traversedir itself...) ob> But I'm wondering if I better should have a list as an ob> addtional parameter, on which I append with readdir. ob> Any design-hints are welcome. One gotcha is that try with ... blocks aren't tail recursive. So if you do that, you'll have to organize the code slightly differently to make your tail call work. John. ------------------- 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