caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* lazy vs fun
@ 2009-08-24 21:57 Warren Harris
  2009-08-24 22:04 ` [Caml-list] " Jake Donham
  2009-08-24 22:06 ` Stéphane Glondu
  0 siblings, 2 replies; 11+ messages in thread
From: Warren Harris @ 2009-08-24 21:57 UTC (permalink / raw)
  To: OCaml

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-08-25 18:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-24 21:57 lazy vs fun 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
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

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).