On 2011-12-23, at 13:26, Fabrice Le Fessant wrote:

> On 12/23/2011 01:04 PM, ri...@happyleptic.org wrote:
>> No you are right, once eta-epxanded the compiler accepted the code.
>> I wonder what difference it makes in the generated code, if any.
>> Thank you very much for the tip!
> 
> The difference is that the function is evaluated everytime you want to
> access the value. If the function is cheap and has no side-effect, it is
> perfectly fine, but if it is not the case, the cost will be much higher.

On the other hand, in the example shown by rixed the function expects
two arguments, so eta-expansion might even be more efficient because
you avoid going through the partial application machinery.

-- Damien


-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to