English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
lazy application to Lazy.t
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-12-07 (21:42)
From: Hal Daume III <hdaume@I...>
Subject: lazy application to Lazy.t
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