caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Stéphane Glondu" <steph@glondu.net>
To: Warren Harris <warren@metaweb.com>
Cc: OCaml <caml-list@inria.fr>
Subject: Re: [Caml-list] lazy vs fun
Date: Tue, 25 Aug 2009 00:06:40 +0200	[thread overview]
Message-ID: <4A930EF0.3050900@glondu.net> (raw)
In-Reply-To: <94AD5806-B6F6-44F7-AA3C-1E63B6C1A722@metaweb.com>

Warren Harris a écrit :
> Is there any advantage to using lazy evaluation in ocaml rather than
> just using thunks to defer evaluation? [...]

Two things I can think of right now: they are evaluated only once (even
if you call Lazy.force several times), and you can do pattern matching
with them.

> Perhaps it's just that the type int lazy_t is more informative than unit -> int?

That one, too.


Cheers,

-- 
Stéphane


  parent reply	other threads:[~2009-08-24 22:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24 21:57 Warren Harris
2009-08-24 22:04 ` [Caml-list] " Jake Donham
2009-08-24 22:15   ` Warren Harris
2009-08-24 22:18     ` Jake Donham
2009-08-24 22:06 ` Stéphane Glondu [this message]
2009-08-24 22:19   ` Martin Jambon
2009-08-24 23:11     ` Martin Jambon
2009-08-24 23:33       ` Warren Harris
2009-08-25  5:19       ` rixed
2009-08-25  6:29         ` David Allsopp
2009-08-25 18:09           ` rixed

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=4A930EF0.3050900@glondu.net \
    --to=steph@glondu.net \
    --cc=caml-list@inria.fr \
    --cc=warren@metaweb.com \
    /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;
as well as URLs for NNTP newsgroup(s).