News for hackers. Stuff that matters.
Re:Anti-Patterns in Python Programming by Peaker on Wednesday July 09, 2014 @03:35PM (#8011784)
In Haskell, the latter looks like:

  alist = (map (**2) . filter (\x -> x `mod` 3 == 0)) myList
Or:

  alist = (map (**2) . filter ((== 0) . (`mod` 3))) myList
If alist is a transformation, and not applied to myList, it's cleaner:

  alist = map (**2) . filter ((== 0) . (`mod` 3))
Though Haskell also has list comprehensions, with more "mathy" syntax:

  alist = [x**2 | x <- mylist, x `mod` 3 == 0]

There are no comments on this comment yet.