Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
NthPortal merged 1 commit intoscala:2.13.xfromNthPortal:topic/ll-again
Jul 2, 2020

Conversation

@NthPortal
Copy link
Contributor

@NthPortalNthPortal commentedJul 1, 2020
edited
Loading

ChangeLazyList.cons.apply so that the tail computation
is wrapped as a state computation for a newLazyList,
thus deferring its execution as long as possible.

Follow-up to#8985


Before (Scala 2.13.3-):

scala2.13.3>LazyList.cons(1, { println("hey");LazyList() })valres6: scala.collection.immutable.LazyList[Int]=LazyList(<not computed>)scala2.13.3> res6.headheyvalres7:Int=1

After (Scala 2.13.4+):

scala2.13.4>LazyList.cons(1, { println("hey");LazyList() })valres6: scala.collection.immutable.LazyList[Int]=LazyList(<not computed>)scala2.13.4> res6.headvalres7:Int=1

@NthPortalNthPortal added the library:collectionsPRs involving changes to the standard collection library labelJul 1, 2020
@scala-jenkinsscala-jenkins added this to the2.13.4 milestoneJul 1, 2020
@SethTisueSethTisue added the release-notesworth highlighting in next release notes labelJul 1, 2020
assertLazyAllSkipping(op,4)
}

privatedefgenericCons_unapply_properlyLazy(unapply:LazyList[Int]=>Option[(Int,LazyList[Int])]):Unit= {
Copy link
ContributorAuthor

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

@NthPortalNthPortal merged commit9208bc4 intoscala:2.13.xJul 2, 2020
@NthPortalNthPortal deleted the topic/ll-again branchJuly 2, 2020 10:23
ijuma added a commit to ijuma/scala-library-compat that referenced this pull requestJul 5, 2020
Port ofscala/scala#9095.Co-authored-by: NthPortal <nthportal@gmail.com>
ijuma added a commit to ijuma/scala-library-compat that referenced this pull requestJul 5, 2020
Port ofscala/scala#9095.Co-authored-by: NthPortal <nthportal@gmail.com>
ijuma added a commit to ijuma/scala-library-compat that referenced this pull requestJul 5, 2020
Port ofscala/scala#9095.Co-authored-by: NthPortal <nthportal@gmail.com>
ijuma added a commit to ijuma/scala-library-compat that referenced this pull requestJul 5, 2020
Port ofscala/scala#9095.Co-authored-by: NthPortal <nthportal@gmail.com>
ijuma added a commit to ijuma/scala-library-compat that referenced this pull requestAug 24, 2020
Port ofscala/scala#9095.Co-authored-by: NthPortal <nthportal@gmail.com>
@SethTisue
Copy link
Member

SethTisue commentedNov 17, 2020
edited
Loading

@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

@NthPortalNthPortal changed the titleMake LazyList.cons.apply lazierIncrease laziness of LazyList.cons.applyNov 20, 2020
@NthPortal
Copy link
ContributorAuthor

@SethTisue is that okay?

@SethTisue
Copy link
Member

@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 seeLazyList.cons.apply my reaction is still "huh? what's that?" and I have to go look it up. an example would really help, I think.

NthPortal reacted with thumbs up emoji

@som-snytt
Copy link
Contributor

"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?

  • No.
NthPortal reacted with laugh emoji

hamzaremmal pushed a commit to hamzaremmal/scala3 that referenced this pull requestMay 2, 2025
hamzaremmal pushed a commit to scala/scala3 that referenced this pull requestMay 7, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@SethTisueSethTisueSethTisue approved these changes

@julienrfjulienrfjulienrf approved these changes

Assignees

No one assigned

Labels

library:collectionsPRs involving changes to the standard collection libraryrelease-notesworth highlighting in next release notes

Projects

None yet

Milestone

2.13.4

Development

Successfully merging this pull request may close these issues.

5 participants

@NthPortal@SethTisue@som-snytt@julienrf@scala-jenkins

[8]ページ先頭

©2009-2025 Movatter.jp