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

Should ZPure#repeat methods return a collection of outcomes instead of the last result? #1482

Open
SimY4 opened this issue Feb 17, 2025 · 0 comments

Comments

@SimY4
Copy link
Contributor

SimY4 commented Feb 17, 2025

I was planning to utilise the state modifiers and repeat methods of ZPure to calculate a sequence of values, something like

val state = State.modify(l: Long => (l.toString, l + 1))
val result = state.repeatN(10).run(0L) // expect (List("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"), 10)

But apparently repeat always returns that latest value. Is that intentional? Or can we change repeat for produce a list, to me I thought the list is generally more useful output. You can always discard all values and keep the last from there.

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

No branches or pull requests

1 participant