Lecture - Functional Programming MT22, XII
Flashcards
Why is it a bad idea to use foldr
or foldl
to calculate something like the sum or product of a list?
foldr
or foldl
to calculate something like the sum or product of a list?Because they are lazy, you can build up a huge expression before evaluating it.
When bounding space is a concern, what fold function should you use?
foldl'