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 RAA09861; Thu, 12 Apr 2001 17:15:08 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 RAA10140 for ; Thu, 12 Apr 2001 17:15:08 +0200 (MET DST) Received: from dpt-info.u-strasbg.fr (dpt-info.u-strasbg.fr [130.79.6.1]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f3CFF6b07527 for ; Thu, 12 Apr 2001 17:15:06 +0200 (MET DST) Received: from lambda.u-strasbg.fr (lambda.u-strasbg.fr [130.79.90.63]) by dpt-info.u-strasbg.fr (8.9.3/8.9.3) with ESMTP id RAA04348; Thu, 12 Apr 2001 17:14:05 +0200 Received: from luther by lambda.u-strasbg.fr with local (Exim 3.22 #1 (Debian)) id 14nip8-00071F-00; Thu, 12 Apr 2001 17:15:54 +0200 Date: Thu, 12 Apr 2001 17:15:54 +0200 To: Mattias Waldau Cc: caml-list@inria.fr Subject: Re: [Caml-list] How do I define prog1? Message-ID: <20010412171554.A26953@lambda.u-strasbg.fr> References: <20010412003442E.garrigue@kurims.kyoto-u.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.17i In-Reply-To: ; from mattias.waldau@abc.se on Thu, Apr 12, 2001 at 02:39:39PM +0200 From: Sven LUTHER Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, Apr 12, 2001 at 02:39:39PM +0200, Mattias Waldau wrote: > I would like to define a (prog1 a b) which first evaluates a, then b, and > returns the > value of a. (Would be nice if I could have arbitrary number of args.) > > I defined it as > > let prog1 a b = a > > Works well in compiled code, first evaluates a, then b. > However bytecode first evaluates b, then a. > > In this cases, call-by-name would be very nice. > > One obvious solution is to write > > let temp = a in > b; > temp The right solution would be : let a = in let b = in prog a b to evaluate a before b, and vice versa. or, if both computation of a and b return unit, you could do : a; b Friendly, Sven Luther ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr