From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 61BE6BC6B for ; Wed, 7 Nov 2007 05:10:25 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAACrJMEfAXQInh2dsb2JhbACOfgEICik X-IronPort-AV: E=Sophos;i="4.21,382,1188770400"; d="scan'208";a="4132367" Received: from concorde.inria.fr ([192.93.2.39]) by mail1-smtp-roc.national.inria.fr with ESMTP; 07 Nov 2007 05:10:25 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id lA74AOuA008173 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 7 Nov 2007 05:10:24 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAABvKMEdA6ba+kmdsb2JhbACOfgEBBwQEExY X-IronPort-AV: E=Sophos;i="4.21,382,1188770400"; d="scan'208";a="5529845" Received: from nf-out-0910.google.com ([64.233.182.190]) by mail3-smtp-sop.national.inria.fr with ESMTP; 07 Nov 2007 05:10:22 +0100 Received: by nf-out-0910.google.com with SMTP id g13so1686376nfb for ; Tue, 06 Nov 2007 20:10:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=TgSyg54WhSzeCMKx2BTttClkcOCqBSU2MkH/cMxRHjg=; b=DZowk4zruvYQOz9MbPkPSOZB3zrqt5gftSaAoDJD5Lqdp/pepHMx5R5bHRXIP3TqMax8b2ZZPV6MgVxeM5+ykdpyRMMwF1QWIYaynlJW0+qXxevyCFL56GRQ7APpiZuZSuvr9t/ky/jnhqvFl2W6VZhL3wcze1rL1ABLJK4t408= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=BqXpoBnzU33jCJcKlmzaprmhwLgeex9UrwuMP75guUTjYj5ywpTZGyb6VfT2VTzT0xnb7tt42bFAYWfxxHwa8VU7GarQySogfHDuC/CFc/lgIWna/k2WkcM1fYDCFbPlhK9Y8Gw3yKCv7uLXPW6NhaNre5yTKGfWYF5JdPteFXA= Received: by 10.78.160.2 with SMTP id i2mr5618214hue.1194408621550; Tue, 06 Nov 2007 20:10:21 -0800 (PST) Received: by 10.78.157.16 with HTTP; Tue, 6 Nov 2007 20:10:21 -0800 (PST) Message-ID: <4a051d930711062010m7e412ffo80480c2b241d8d1d@mail.gmail.com> Date: Tue, 6 Nov 2007 23:10:21 -0500 From: "Christopher L Conway" Sender: christopherleeconway@gmail.com To: caml-list@inria.fr Subject: Re: [Caml-list] log function without evaluate arguments In-Reply-To: <20071107150016.61b256ac.mle+ocaml@mega-nerd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <47309EEC.4080706@menta.net> <1194373338-sup-9994@ausone.local> <9d3ec8300711061040l424aac69y4b859a029d815089@mail.gmail.com> <4730B72B.3000109@janestcapital.com> <4a051d930711061939p621c0a8ao4472a82973dcc855@mail.gmail.com> <20071107150016.61b256ac.mle+ocaml@mega-nerd.com> X-Google-Sender-Auth: 57de51b7ad0e2c1f X-Miltered: at concorde with ID 47313AB0.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 printf:01 printf:01 wrote:01 wrote:01 caml-list:01 computation:01 computation:01 lazy:02 lazy:02 argument:02 argument:02 erik:04 correctly:04 On 11/6/07, Erik de Castro Lopo wrote: > Christopher L Conway wrote: > > > On 11/6/07, Brian Hurt wrote: > > > Also, creating a lazy thunk in Ocaml is expensive (like 140+ clock cycles), > > > while passing an argument into a function is cheap- and the common case will > > > be that the argument won't need to be evaluated, just passed in. > > > > What does this mean? Did OCaml become non-strict while I wasn't looking? > > Ocaml is strict by default and optionally lazy. > > The code being discussed was this: > > log (lazy (Printf.printf "%s" (awfully_long_computation ()))) > > where everything inside > > (lazy X) > > is lazy evaluated. Yes, of course. But, if I understand correctly, Brian was arguing in favor of Printf.ifprinf "%s" (awfully_long_computation ()) and claiming that it was potentially more efficient than the lazy version. Chris