Browse thread
Parameter evaluation order
-
Márk_S._Zoltán
- Alain Frisch
- Damien Doligez
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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