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

Why does lazy list foldr reverse into a temporary lazy list? #197

Open
FranklinChen opened this issue Mar 9, 2021 · 1 comment
Open
Labels
type: enhancement A new feature or addition.

Comments

@FranklinChen
Copy link

I get why https://github.com/purescript/purescript-lists/blob/v6.0.0/src/Data/List/Lazy/Types.purs#L121 does what it does with reverse, but it seems to me there is no reason to create a brand new temporary lazy list just to consume it left to right. How about pushing elements left to right into a temporary JavaScript array and then going right to left in that?

@milesfrain
Copy link
Contributor

No objections to optimizing by using a temporary JS array.
I think the existing version was chosen just to keep the code concise at the cost of performance.

Another issue discussing improving reverse performance is #185

@JordanMartinez JordanMartinez added the type: enhancement A new feature or addition. label Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A new feature or addition.
Projects
None yet
Development

No branches or pull requests

3 participants