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
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&
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
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
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