From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA20998; Wed, 30 Jun 2004 15:31:58 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA20983 for ; Wed, 30 Jun 2004 15:31:57 +0200 (MET DST) Received: from mproxy.gmail.com (mproxy.gmail.com [216.239.56.242]) by nez-perce.inria.fr (8.12.10/8.12.10) with SMTP id i5UDVuEV031390 for ; Wed, 30 Jun 2004 15:31:56 +0200 Received: by mproxy.gmail.com with SMTP id w29so1849772cwb for ; Wed, 30 Jun 2004 06:31:55 -0700 (PDT) Received: by 10.11.99.30 with SMTP id w30mr152cwb; Wed, 30 Jun 2004 06:31:55 -0700 (PDT) Message-ID: Date: Wed, 30 Jun 2004 15:31:47 +0200 From: henri dubois-ferriere To: Ocaml Subject: [Caml-list] lazy vs function for values that are used once at most Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 40E2C0CC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; henridf:01 passing:01 passing:01 meets:99 closure:01 lazy:02 lazy:02 overhead:03 henri:03 henri:03 equivalent:05 guess:06 forcing:06 maybe:06 fun:08 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk hi, when one has a value v that is going to be either used 0 or 1 time, is there any difference in terms of overhead (ie for building the closure, GC performance, etc) between passing around (lazy v) and then forcing the value if needed, or passing around (fun () -> v) and evaluating f when needed? i would guess these are equivalent overhead-wise but maybe there's more to it than meets the eye. thanks henri ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners