caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Warren Harris <warren@metaweb.com>
To: OCaml <caml-list@inria.fr>
Subject: lazy vs fun
Date: Mon, 24 Aug 2009 14:57:19 -0700	[thread overview]
Message-ID: <94AD5806-B6F6-44F7-AA3C-1E63B6C1A722@metaweb.com> (raw)

Is there any advantage to using lazy evaluation in ocaml rather than  
just using thunks to defer evaluation? E.g.

let x = lazy (3+4)
let y = Lazy.force x

vs:

let x = fun () -> 3+4
let y = x ()

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

Warren


             reply	other threads:[~2009-08-24 21:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24 21:57 Warren Harris [this message]
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
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=94AD5806-B6F6-44F7-AA3C-1E63B6C1A722@metaweb.com \
    --to=warren@metaweb.com \
    --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;
as well as URLs for NNTP newsgroup(s).