[Haskell-cafe] Haskell vs OCaml

Daniel Carrera daniel.carrera at zmsl.com
Sun Dec 25 07:02:56 EST 2005


Branimir Maksimovic wrote:
> Well I want simple loop for(int i =0;i<10;++i)doSomething(i);
> in haskell that would be
> for begin end f | begin /= end = do  {f begin ; for (begin+1) end f}
>                 | otherwise = return ()

How about:

result = [ doSomething(i) | i <- [0..9] ]

I guess it depends on what doSomething() does.

Cheers,
Daniel.
-- 
      /\/`) http://oooauthors.org
     /\/_/  http://opendocumentfellowship.org
    /\/_/
    \/_/    I am not over-weight, I am under-tall.
    /


More information about the Haskell-Cafe mailing list