On 15/05/06, w chun <[EMAIL PROTECTED]> wrote:
> anyone know if list comps work the same way in haskell?

Slightly not what you asked, but you can do some funky things with
list comprehensions in Haskell.

Check this out:

fibs = 0 : 1 : [ a + b | (a, b) <- zip fibs (tail fibs)]

The python translation would be something like:

fibs = [0, 1] + [ a+b for (a, b) in zip(fibs, fibs[1:])]

But you can't quite do that in python :-)

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to