list-comprehension example. comparing to Haskell implementation