
24 Dec
2013
24 Dec
'13
8:47 a.m.
Given foldl (+) 0 [1..10] (+) is (a -> b -> a) 0 is a [1..10] is [b] and the final a is the result of the expression. On Tuesday, December 24, 2013, Angus Comber wrote:
The type is:
foldl :: (a -> b -> a) -> a -> [b] -> a
Eg I might do something like this:
foldl (+) 0 [1..10]
so taking (a -> b -> a)
leftmost a is (+) b is 0 right a is what? The first value in the list?
Then -> ?
[b] ? Is this like the temporary recursion calculation?
final -> a is the result?