Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Hal Daume III <hdaume@ISI.EDU>
To: Caml Mailing List <caml-list@yquem.inria.fr>
Subject: lazy application to Lazy.t
Date: Tue, 7 Dec 2004 13:41:45 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0412071339360.26422-100000@albini.isi.edu> (raw)

suppose I have

  val x : int ref Lazy.t

and I want to 'incr' it, but want to keep it lazy.  i.e., if i start with:

  let x = Lazy.lazy_from_fun (fun () -> ref 0)

then i run my lazy_incr on it, I want:

  let y = Lazy.force x

to return 1

but i only want 'incr' to be run when I Lazy.force x.  is there a way to 
accomplish this?

  

-- 
 Hal Daume III                                   | hdaume@isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume


             reply	other threads:[~2004-12-07 21:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-07 21:41 Hal Daume III [this message]
2004-12-08  0:29 ` [Caml-list] " Karl Zilles

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.4.44.0412071339360.26422-100000@albini.isi.edu \
    --to=hdaume@isi.edu \
    --cc=caml-list@yquem.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