Hi all,
the problem is simple but i can't do it :
I want to generate some values and 'accumulate' them. The meaning of
'accumulating' is not so important. The only point is that to
'accumulate' the values, I only have to know one value and the
accumulator (and not all the values).
The most simp
I run into the problem with test1 all the time: It's accumulating
partially evaluated expressions like this:
1+1+1+1+1+1+...
and filling up memory. Try foldl' instead, and look here:
http://en.wikibooks.org/wiki/Programming:Haskell_List_Processing
Also have a look at this past discussion:
ht
Hello minh,
Monday, May 8, 2006, 12:28:35 PM, you wrote:
> acc1 ints = foldr (+) 0 ints
foldl?
> --
> acc2 ints = execState (mapM add2 ints) 0
> add2 :: Int -> State Int ()
> add2 i = do
> acc <- get
> put (acc + i)
thanks for your answers,
i guess i have to look at strictness and such 'optimizations', ...
mt
2006/5/9, Bulat Ziganshin <[EMAIL PROTECTED]>:
Hello minh,
Monday, May 8, 2006, 12:28:35 PM, you wrote:
> acc1 ints = foldr (+) 0 ints
foldl?
> -