Assignment versus binding
Rustom Mody
rustompmody at gmail.com
Tue Oct 4 13:17:41 EDT 2016
On Tuesday, October 4, 2016 at 10:15:10 PM UTC+5:30, Steve D'Aprano wrote:
> On Tue, 4 Oct 2016 11:27 pm, Ben Bacarisse wrote:
>
> > Haskell defines let (it's version of multiple mutually recursive
> > bindings) in terms of the least fix point of a lambda function whose
> > (pattern) parameter binds the expressions in the definitions.
>
> It binds *the expression* itself? Not the value of the expression?
Lazy evaluation — one of the more touted features of Haskell — uses call-by-need
which is like memoized call-by-name:
https://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_need
>
> So Haskell uses some form of pass by name?
>
> And (shamelessly using Python syntax) if I have a function:
>
>
> def spam(x):
> print(x)
> print(x+1)
>
>
> and then call it:
>
> spam(time.sleep(60) or 1)
>
>
> it will sleep for 60 seconds, print 1, then sleep for another 60 seconds,
> then print 2. Is that right?
Strong type system would not allow mixing of effects and values like that
More information about the Python-list
mailing list