Version française
Home     About     Download     Resources     Contact us    
Browse thread
Parameter evaluation order
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain Frisch <Alain.Frisch@i...>
Subject: Re: [Caml-list] Parameter evaluation order
Márk S. Zoltán wrote:
> But I do think that currying + strictness + side-effects =>
> left-to-right evaluation order.  That is because a multi-parameter
> function application should be functionally equivalent to a closure
> taking the first (== leftmost) parameter and returning a closure which
> takes the second parameter 

It is, but your conclusion about left-to-right evaluation order is
wrong. It's just that the binary application operator evaluates first
its second argument (the function's argument), then its first argument
(the functional value), and finally applies the function to the
argument. An application (e1 e2) is semantically equivalent to:  (let y
= e2 in let x = e1 in x y). Hence you get right-to-left evaluation order
(but this is not specified).

-- Alain