3 ms·
What do you mean by the last paragraph? foldl in Haskell is just foldl _ acc [] = acc foldl f acc (x:xs) = foldl f (f acc x) xs And in Python some
by kbp 8y ago
What do you mean by the last paragraph? foldl in Haskell is just
foldl _ acc [] = acc
foldl f acc (x:xs) = foldl f (f acc x) xs
And in Python something like
def foldl(f, acc, l):
for x in l:
acc = f(acc, x)
return acc
Which doesn't seem much harder to read or write than any other version, to me (it's all just syntax around the same algorithm).