Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Caml-list] Future of labels
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-04-12 (14:27)
From: Vitaly Lugovsky <vsl@o...>
Subject: Re: [Caml-list] How do I define prog1?
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  Archives: