[Haskell-cafe] Slow IO or bad code?

Marc Weber marco-oweber at gmx.de
Thu Aug 9 10:27:22 EDT 2007


> I wrote a code, but seems to give "Time limit exceeded"!
??
Your code writes
15 to stdout which is correct (with the example given on the page)..
You have to explain what you mean by >>seems to give "Time limit exceeded"<<

> loop t function
Does already exist.
sequence $ replicate 10 function
is a much shorter way :-)

oor perhaps mapM_ [ function | i <- [1..10] ] )

prod, to_int:
You can both implement using higher order functions

prod = sum . zipWith (*)
to_int = map read

Marc


More information about the Haskell-Cafe mailing list