Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix strictness of foldl' & foldr' #96

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

konsumlamm
Copy link
Contributor

Since they used foldl/foldr, they were not actually strict. I also tried the versions used in base (using foldl for foldr' and foldr for foldl'), but they were worse in my micro-benchmark (I ran print $ foldl' (+) 0 [1..10_000::Int]/print $ foldr' (+) 0 [1..10_000::Int] and checked the number of reductions and memory usage), although the alternative foldl' actually uses less memory.

@augustss augustss merged commit f56d107 into augustss:master Jan 23, 2025
13 checks passed
@augustss
Copy link
Owner

Oops. Thanks!

@konsumlamm konsumlamm deleted the strict-fold branch January 23, 2025 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants