Transmitting parameters

Ashley Yakeley ashley@semantic.org
Fri, 2 Nov 2001 02:26:33 -0800


At 2001-11-02 02:21, Jon Fairbairn wrote:

>> >What mechanism of transmiting parameters does Haskell implement?
>> 
>> By value.
>
>Yes, though one might equally say that they are passed by
>reference, since in
>
>g = let f x = x+x
>        z = factorial 1000
>     in f z * z
>
>the 'first' instance of x forces z to be evaluated and
>updated, the second instance of x uses this updated value,
>and so does the final occurrence of z.

Oh, yeah, they're passed by thunk. I forgot about the laziness.

-- 
Ashley Yakeley, Seattle WA