Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Don't Haskell and Python use the same argument order?

    filter(lambda x: x<5, map(lambda x: 2*x, [1,2,3,4,5]))

    filter (<5) . map (*2) $ [1,2,3,4,5]
(Technically the Python version should be cast to a list to have identical behavior.)

Same with comprehensions (although nesting comprehensions will always get weird).

    [x for x in [2*x for x in [1,2,3,4,5]] if x<5]

    [x | x <- [2*x | x <- [1,2,3,4,5]], x<5]


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: