- Notifications
You must be signed in to change notification settings - Fork3.1k
Increase laziness of LazyList.cons.apply#9095
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| assertLazyAllSkipping(op,4) | ||
| } | ||
| privatedefgenericCons_unapply_properlyLazy(unapply:LazyList[Int]=>Option[(Int,LazyList[Int])]):Unit= { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I noticed there were no tests for these while I was in the area, so I added tests
Port ofscala/scala#9095.Co-authored-by: NthPortal <nthportal@gmail.com>
Port ofscala/scala#9095.Co-authored-by: NthPortal <nthportal@gmail.com>
Port ofscala/scala#9095.Co-authored-by: NthPortal <nthportal@gmail.com>
Port ofscala/scala#9095.Co-authored-by: NthPortal <nthportal@gmail.com>
Port ofscala/scala#9095.Co-authored-by: NthPortal <nthportal@gmail.com>
SethTisue commentedNov 17, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@NthPortal would you mind improving the PR title and description to be at least a little more informative for end users? since we're linking to this from the 2.13.4 release notes perhaps you can borrow some verbiage from the discussion on#8985 |
NthPortal commentedNov 20, 2020
@SethTisue is that okay? |
SethTisue commentedNov 20, 2020
@NthPortal better — if you want to improve it further, I would suggest adding an example code snippet that is affected by the change, and describe how it is affected. even though I've looked at this stuff multiple times before, when I see |
som-snytt commentedNov 20, 2020
"If you're as lazy as LazyList, you probably don't need to know more." Sometimes it helps to be usefully vague. Do I need to learn this?
|
Make LazyList.cons.apply lazier
Make LazyList.cons.apply lazier
Uh oh!
There was an error while loading.Please reload this page.
Change
LazyList.cons.applyso that the tail computationis wrapped as a state computation for a new
LazyList,thus deferring its execution as long as possible.
Follow-up to#8985
Before (Scala 2.13.3-):
After (Scala 2.13.4+):