[Tutor] Are you allowed to shoot camels? [kinda OT]

Sean Perry shaleh at speakeasy.net
Thu Feb 3 23:10:07 CET 2005


Jeff Shannon wrote:
> 
> However, Python doesn't need lambdas to be able to write in a functional 
> style.  Functions are first-class objects and can be passed around quite 
> easily, and IIRC Python's list comprehensions were borrowed (though 
> probably with notable modification) from Haskell.
> 

Note, it is haskell convention to name a list of objects with a plural. 
So xs -> list of x.

haskell:

[ x | x <- xs ]
[ foo x | x <- xs, x > 2 ]

python

[ x for x in xs ]
[ foo(x) for x in xs if x > 2 ]

shaleh
still mastering haskell, but loving it. Like python for functional 
languages.


More information about the Tutor mailing list