-
Notifications
You must be signed in to change notification settings - Fork 31
Fold directly #137
base: master
Are you sure you want to change the base?
Fold directly #137
Conversation
use a foldl-based foldMap
ee9a47b
to
3ae9cc1
Compare
3ae9cc1
to
4c2e6e4
Compare
This seems very similar to the implementation used in #132; can this be abstracted into a single function which all of these depend on? I also wouldn't want to have |
Will try.
|
implement foldl in terms of foldlWithIndex. Effect on benchmarks is negligible.
Reveals that it is very, very un-stack-safe
After attempting to do this, I've restored right folds to using the intermediate lists. Any attempt to do a right fold directly on the |
any attempt at directly folding is not stack safe
5fd2b86
to
7047e62
Compare
I can't see a way to do this. It seems to me that folding and |
I've edited down my last two posts here... I believe common functionality between |
solves #134
This gives over a 10x speed improvement on larger maps (compare branch https://github.com/matthewleon/purescript-maps/tree/foldl-bench):
before
after