From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id B128EBB81 for ; Mon, 26 Sep 2005 06:32:42 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j8Q4WfAk030992 for ; Mon, 26 Sep 2005 06:32:42 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id GAA30517 for ; Mon, 26 Sep 2005 06:32:41 +0200 (MET DST) Received: from web26809.mail.ukl.yahoo.com (web26809.mail.ukl.yahoo.com [217.146.176.85]) by concorde.inria.fr (8.13.0/8.13.0) with SMTP id j8Q4WeBV030989 for ; Mon, 26 Sep 2005 06:32:41 +0200 Received: (qmail 24011 invoked by uid 60001); 26 Sep 2005 04:32:40 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.de; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=6pZiPNBHVMWQBrRXfIMvzdPDE32aMOn02Ju/w1PxowaLjbR8h6ZPnV5PKs1BrQNxCGdPAGXj44Or5E8EbgJf2eoP2Bd3hIryN4GpHsLthlkvfmN2AfXEZEJua6cedUcu9mUEKKNmPR63TODzaHKVpU56QH2Qv0EpiyZcVYPq+OI= ; Message-ID: <20050926043240.24009.qmail@web26809.mail.ukl.yahoo.com> Received: from [213.103.158.232] by web26809.mail.ukl.yahoo.com via HTTP; Mon, 26 Sep 2005 06:32:40 CEST Date: Mon, 26 Sep 2005 06:32:40 +0200 (CEST) From: Martin Chabr Subject: Ant: [Caml-list] Efficiency of let/and To: Brian Hurt Cc: caml-list@inria.fr In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 433779E9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 433779E8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 -form:01 set-:01 expr:01 expr:01 parallelism:01 caml-list:01 beginner's:01 ocaml:01 beginners:01 bug:01 ...:98 gesendet:98 jetzt:98 anmelden:98 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 As it appears to me, there is no semantic difference between both alternatives. It can be shown with two dependent expressions y = 1 and z = y + 2: # let y = 1 in let z = y + 2 in z;; - : int = 3 # let y = 1 and z = y + 2 in z;; - : int = 3 The order is important in both cases: # let z = y + 2 in let y = x + 1 in z;; Characters 8-9: let z = y + 2 in ^ Unbound value y # let z = y + 2 and y = 1 in z;; Characters 8-9: let z = y + 2 ^ Unbound value y So the "and"-form depends on the order as well and I think the syntactic difference can be just used for documentation. A good idea, by the way. I hope this helps Martin --- Brian Hurt schrieb: > > Say I have two variables I want to set- variable a > to the value expr1 and > variable b to the value expr2. The two expressions > are pure (no side > effects), and neither one depends upon the other > (neither expr1 nor expr2 > contain either a or b as a value), so they can be > evaluated in either > order or in parallel with no harm. With expressions > like these, I've > gotten into the habit of using let/and to express > the parallelism, that is > I go: > > let a = expr1 > and b = expr2 > in > ... > > rather than: > let a = expr1 in > let b = expr2 in > > So my question is: is there any value (other than > the documentation value) > in doing this? > > Just wondering. > > Brian > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: > http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > ___________________________________________________________ Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de