Skip to content

v2.0 - feature: Update iterator family of methods to just be generators, where it makes sense #121

Description

@elycruz

#75 and #87 covered most of this. Already generators: cycle, iterate,
range, repeat.

Remaining:

  • replicate — still eager (Array(n).fill(x, 0, n) returns T[], in
    packages/fjl/src/list/replicate.ts). next: iterate, repeat, replicate, and cycle methods should just be generators #75 marked this done, but it was
    never converted.
  • unfoldr — accumulates into const out = [] as A[] and returns A[]
    (packages/fjl/src/list/unfoldr.ts); a generator lets callers stop early.
  • Audit scanl/scanl1/scanr/scanr1 and zip*/unzip*, and record
    which should stay eager. A documented decision counts as done.

Where a generator would break existing consumers, keep the eager version and
add a *-suffixed generator sibling rather than changing the return type.

The replicate mis-tick is what prompted #125.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgroomedTicket has been groomed for development.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions