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

And a haskell version (not the shortest possible one):

  takeWhile (< 100) fibs
        where fibs = 0 : 1 : zipWith (+) fibs $ tail fibs
I don't think fibs can be expressed as a list comprehension in haskell, can it? It's cute that perl6 is able to use one, but OTOH I can't think of many other lists I'd want to use that trick to calculate.

And, despite having written perl for 15 years, I find the haskell version much clearer, and its use of laziness and infinite lists (zipping them up in particular) much more advanced than perl6's.



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

Search: