Skip to content

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

@SimY4

Description

@SimY4

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions