Skip to content

Is this actually a lazy left scan? #159

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

Closed
drewolson opened this issue May 13, 2019 · 1 comment · Fixed by #161
Closed

Is this actually a lazy left scan? #159

drewolson opened this issue May 13, 2019 · 1 comment · Fixed by #161

Comments

@drewolson
Copy link

scanrLazy :: forall a b. (a -> b -> b) -> b -> List a -> List b

The more I look at this, the more I am convinced that this is a left scan with the args to the function swapped. The following test seems to confirm this:

> fromFoldable $ scanrLazy (flip (-)) 10 (1..3)
(9 : 7 : 4 : Nil)

I believe I named this incorrectly when submitting the PR. Would love more input from folks who are more experienced.

@natefaubion
Copy link
Contributor

Yes, this is a left scan, since you accumulate the head of the list before casing on the tail.

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 a pull request may close this issue.

2 participants