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 QAA08967; Thu, 12 Apr 2001 16:27:02 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 QAA08980 for ; Thu, 12 Apr 2001 16:27:01 +0200 (MET DST) Received: from ontil.ihep.su (ontil.ihep.su [194.190.161.63]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f3CEQCT24144 for ; Thu, 12 Apr 2001 16:26:12 +0200 (MET DST) Received: from localhost (vsl@localhost) by ontil.ihep.su (8.11.0/8.11.0) with ESMTP id f3CEMu502753; Thu, 12 Apr 2001 18:22:56 +0400 Date: Thu, 12 Apr 2001 18:22:56 +0400 (MSD) From: Vitaly Lugovsky To: Mattias Waldau cc: Subject: Re: [Caml-list] How do I define prog1? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 12 Apr 2001, 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.) What is it for? There must be a better solution! > 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. Evaluation order is not defined. And it must not be defined for functional languages. > One obvious solution is to write > > let temp = a in > b; > temp > > but that is much too clumsy. What is a type of 'a' and 'b'? And do you really want to evaluate them before the function call? ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr