From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 6ED8FBB81 for ; Sun, 12 Dec 2004 03:36:41 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBC2af1e021979 for ; Sun, 12 Dec 2004 03:36:41 +0100 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 DAA08134 for ; Sun, 12 Dec 2004 03:36:40 +0100 (MET) Received: from nexus.stwing.upenn.edu (NEXUS.STWING.UPENN.EDU [165.123.132.61]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBC2ac1A021976 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sun, 12 Dec 2004 03:36:40 +0100 Received: from force.stwing.upenn.edu (force.stwing.upenn.edu [165.123.132.65]) by nexus.stwing.upenn.edu (8.12.10/8.12.9) with ESMTP id iBC2abHA016953 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sat, 11 Dec 2004 21:36:38 -0500 (EST) Received: from force.stwing.upenn.edu (localhost [127.0.0.1]) by force.stwing.upenn.edu (8.12.10/8.12.9) with ESMTP id iBC2abh4028141 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 11 Dec 2004 21:36:37 -0500 (EST) Received: (from wlovas@localhost) by force.stwing.upenn.edu (8.12.10/8.12.9/Submit) id iBC2aaa3028124 for caml-list@inria.fr; Sat, 11 Dec 2004 21:36:36 -0500 (EST) Date: Sat, 11 Dec 2004 21:36:36 -0500 From: William Lovas To: caml-list Subject: Re: [Caml-list] environment idiom Message-ID: <20041212023636.GA12724@force.stwing.upenn.edu> Mail-Followup-To: caml-list References: <9410EC84C0872141B27A2726613EF45D02A52E08@psmrdcex01.psm.pin.safeco.com> <41B97FD7.50309@andrej.com> <1102732237.2611.580.camel@pelican.wigram> <41BB04D8.60405@andrej.com> <20041211181313.GA9656@fichte.ai.univie.ac.at> <1102809398.2611.637.camel@pelican.wigram> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1102809398.2611.637.camel@pelican.wigram> User-Agent: Mutt/1.5.4i X-Miltered: at nez-perce with ID 41BBAEB9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41BBAEB7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lovas:01 wlovas:01 stwing:01 upenn:01 caml-list:01 wrote:01 ocaml:01 haskell:01 o'caml:01 haskell:01 o'caml:01 cheers:01 ...:98 idiom:01 functions:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: On Sun, Dec 12, 2004 at 10:56:38AM +1100, skaller wrote: > The bottom line is that given an environment E > > f: A -> B > > is not functional if f fiddles with environment E. > It is absurd then to think that > > f: E * A -> E * B > > is suddenly purely functional, just because the environment > is now made explicit. [...] I'm not sure i buy this: if f returns the same result every time it's called with the same argument, and calling f cannot affect the behavior of any other part of your progrem, then in what way is f not purely functional? > A final example. Ocaml *is* purely functional. As long > as you consider references as values -- rather than what > they refer to. In reality, it's just a state transformer > monad like Haskell, only the encoding is built in to > the language. But there exist "functions" in O'Caml whose behavior is not always the same for a given argument, namely (!). Does Haskell have such "functions"? You're blurring some definitions fairly substantially when you say things like "Haskell is not purely functional, but O'Caml is" :) cheers, William