[FP] Rewriting name bindings as expressions
Richard Davies
richardd at pobox.com
Sat May 26 13:32:37 EDT 2001
> > z = let y = x+1 in y+y*y
> >
> > becomes
> >
> > z = [y+y*y for y in x+1,][0]
> >
> > which is good, but could be nicer if we never had to
> > bring lists into it...
>
> Doesn't this just become [z for y in x+1, for z in y+y*y,] ?
> Where of course the first z could be anything you like.
But at some point you're going to have to end the list comprehension
and actually return a value to the rest of the program...
At this point it's a shame that you've brought lists comprehensions
into it at all, and so need to do the [0].
Maybe you're proposing that our entire program is written inside
one vast list comprehension?
Richard.
More information about the Python-list
mailing list