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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 1ECBBBBCA for ; Thu, 28 Feb 2008 00:46:46 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAAeFxUfAXQInh2dsb2JhbACQaAEBAQgKKYENlBGHfA X-IronPort-AV: E=Sophos;i="4.25,416,1199660400"; d="scan'208";a="23134729" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 28 Feb 2008 00:46:45 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m1RNkjTw001336 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 28 Feb 2008 00:46:45 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAI+ExUfRVYTxkGdsb2JhbACQaAEBAQEHBAYHChEFgQ+UH4d8 X-IronPort-AV: E=Sophos;i="4.25,416,1199660400"; d="scan'208";a="8686930" Received: from an-out-0708.google.com ([209.85.132.241]) by mail1-smtp-roc.national.inria.fr with ESMTP; 28 Feb 2008 00:46:44 +0100 Received: by an-out-0708.google.com with SMTP id c24so701169ana.97 for ; Wed, 27 Feb 2008 15:46:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=NpEQynxlOuNtTjOAUeqds7rDdFRrm+n+0m+MQMii+2Y=; b=sKc9LTjiZA/z+qN1z0LTSfZT+NgTygh9cKJLF74BZRooX5J6/PbUODDzkEzAYlGYIAuT35z/f8+SMSG/djcZVVRCuk97Mr6i/7qgMTKP/ewgYiVcFZW+fau9wUkU6kaK/nlUBDaQJnvfdVXcPEOTG29WbGliz1lT/Jut/2xp+Yk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=RS2uFkj+Q/tPq39+sxWuQk3z0FymlwoMmynNOH3nHzRevmGIm9CGRdqItgmpvcXfrfcG+cKWomfh2v+qy2X9pCocSRMH2FvShgV2Vs7WTts0kJTzrV9zK4nQYv3L6KzApsKcL/DOepAtmPfSnlSlbdaHANI7KzNS7abN8JQCazw= Received: by 10.100.12.1 with SMTP id 1mr13455775anl.97.1204156003766; Wed, 27 Feb 2008 15:46:43 -0800 (PST) Received: by 10.100.248.15 with HTTP; Wed, 27 Feb 2008 15:46:43 -0800 (PST) Message-ID: <6f9f8f4a0802271546i407494ebm8ce10e98000c4313@mail.gmail.com> Date: Thu, 28 Feb 2008 00:46:43 +0100 From: "Loup Vaillant" To: pal_engstad@naughtydog.com Subject: Re: [Caml-list] Unexpected restriction in "let rec" expressions Cc: "Caml List" In-Reply-To: <47C5B3EC.1080206@naughtydog.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6f9f8f4a0802260424o5bce2fd9i89fbfa38bb239a6a@mail.gmail.com> <47C5B3EC.1080206@naughtydog.com> X-Miltered: at concorde with ID 47C5F665.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; haskell:01 pointers:01 pointer:01 haskell:01 subtleties:01 compiler:01 ocaml:01 wrote:01 rec:01 graph:01 caml-list:01 immutable:01 semantic:02 lazy:02 lazy:02 Yahoo! I got it, many thanks! 2008/2/27, Pal-Kristian Engstad : > Loup Vaillant wrote: > > loop :: ((a,c) -> (b,c)) -> a -> b > > loop f a = b > > where (b,c) = f (a,c) > > Remember that values in Haskell are lazy, which simply means that they > are pointers to things that is either a pointer to a function to > evaluate it, or the cached value. (This works, since all Haskell values > are immutable.) No problem with that. I just have some subtleties to learn about lazy graph reduction yet. What is a bit harder is to turn myself in a strictness analyzer when writing lazy code in my favorite strict language :-). > [...] > > In other words, we're telling the compiler: Given a function f :: (a, c) > -> (b, c) and a value of type a, loop f a will give the result b by > evaluating (b, c') = f (a, c) where c' == c always. That is the explanation I have waited for. I didn't have the idea to push mathematical reasoning to the end, so I continued to bother myself with an order of evaluation (even lazy), forgetting what a non strict semantic really means. Thank you. Loup PS: do you use Ocaml (or whatever FP language or technique) at naughtydog? What for, then (provided you can tell me, of course)?