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

Replace lazy Sequences by lazyMemoizedSequence #2370

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ting-yuan
Copy link
Collaborator

where the intermediate functions applied on the sequence are pure and cost effective.

Unlike simple lazy values, intermediate functions applied in lazy properties of Sequence types are computed repeatedly. For example, square() is called each time x is read.

val x: Sequence<Int> by lazy { listOf(1, 2, 3).map { square(it) } }

lazyMemoizedSequence caches the values of the sequence.

Also replaced the stateful implementation of
KSClassDeclarationImpl.declarations by a stateless one.

where the intermediate functions applied on the sequence are pure and
cost effective.

Unlike simple lazy values, intermediate functions applied in lazy
properties of Sequence types are computed repeatedly. For example,
square() is called each time x is read.

    val x: Sequence<Int> by lazy { listOf(1, 2, 3).map { square(it) } }

lazyMemoizedSequence caches the values of the sequence.

Also replaced the stateful implementation of
KSClassDeclarationImpl.declarations by a stateless one.
@ting-yuan ting-yuan requested review from dx404 and jsjeon March 8, 2025 04:13
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