[Haskell-cafe] definition of sum

2010-03-10 Thread TeXitoi
After programming as an exercice the sum function, my version is faster than the Data.List's version. Looking at the source code, Data.List uses a foldl and not a foldl'. foldl' seems faster and allows to use very big lists. So, why is foldl used by Data.List for sum? -- Guillaume Pinot

[Haskell-cafe] Re: definition of sum

2010-03-10 Thread TeXitoi
Daniel Fischer writes: > Am Mittwoch 10 März 2010 22:33:43 schrieb TeXitoi: > > After programming as an exercice the sum function, my version is > > faster than the Data.List's version. Looking at the source code, > > Data.List uses a foldl and not a foldl'. foldl&

[Haskell-cafe] Re: Occurs check error, help!

2010-03-21 Thread TeXitoi
boblettoj writes: > newStdGen results in IO Ints whereas i need normal Ints and it seems theres > no easy way to convert them without a lot more knowledge of haskell. I have > tried using a where clause instead of using do but this is giving me the > occurs check error again! > > --function used

[Haskell-cafe] Re: Bytestrings and [Char]

2010-03-23 Thread TeXitoi
Iustin Pop writes: > On Tue, Mar 23, 2010 at 03:31:33PM -0400, Nick Bowler wrote: > > > So that's a 30% reduction in throughput. I'd say that's a lot worse > > than a few percentage points, but certainly not orders of magnitude. > > Because you're possibly benchmarking the disk also. With a 400

[Haskell-cafe] Re: A function that makes list of Bool lists from list of Int lists

2010-04-04 Thread TeXitoi
Alexandru Scvortov writes: > Too many points. > > listbool :: [[a]] -> [[Bool]] > listbool = zipWith ($) (map (map . const) (cycle [True, False])) If we choose to zipWith ($), maybe this will do a little less work : listbool = zipWith ($) (cycle $ map (map . const) [True, False]) (ie cycle