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

> Haskell doesn't really have "loops"

weeell, you can still do stuff like this in Haskell:

     import Data.Vector.Mutable
     ...
     let n = length vec
     forM_ [0 .. n-1] $ \i -> do
       next <- if i < n-1 then read vec (i+1) else pure 0
       modify vec (+ next) i -- increase this value by next value
it's just in many cases the functional machinery is so accessible that you don't need to reach for for-loops.


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

Search: