Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Oliver Bandel <oliver@first.in-berlin.de>
To: Alan Schmitt <alan.schmitt@inria.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Stack Overflow... (recursion in try-statement)
Date: Wed, 24 Apr 2002 15:25:11 +0200 (MET DST)	[thread overview]
Message-ID: <Pine.LNX.3.95.1020424152228.846B-100000@first.in-berlin.de> (raw)
In-Reply-To: <20020424045225.GD2828@alan-schm1p>



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


      parent reply	other threads:[~2002-04-24 13:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-23 21:48 Oliver Bandel
2002-04-23 22:23 ` Will Benton
2002-04-23 22:50 ` Oliver Bandel
2002-04-23 23:25   ` John Prevost
2002-05-21 18:34     ` [Caml-list] Is CVS version of ocaml faster? John Max Skaller
2002-05-22  3:03       ` Jacques Garrigue
2002-05-22 16:29         ` John Max Skaller
2002-06-30 17:25     ` [Caml-list] ocamllex -- ambiguous regex John Max Skaller
2002-07-01 11:45       ` Xavier Leroy
2002-06-30 17:27     ` [Caml-list] Manual broken -- set John Max Skaller
2002-04-24  1:01 ` [Caml-list] Stack Overflow... (recursion in try-statement) Warp
2002-04-24 13:22   ` Oliver Bandel
2002-04-24  4:10 ` John Prevost
2002-04-24  4:52 ` Alan Schmitt
2002-04-24  5:31   ` Charles Martin
2002-04-24 13:25   ` Oliver Bandel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.3.95.1020424152228.846B-100000@first.in-berlin.de \
    --to=oliver@first.in-berlin.de \
    --cc=alan.schmitt@inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox