Skip to content

spanWith, takeWhileWith #362

@devvythelopper

Description

@devvythelopper

It would be nice to have a variant of span and a variant of takeWhile that do not just apply a predicate, but also fold over a value.

The practical application I have in mind is to span or takeWhile but only up to a maximum number of characters. This of course could be implemented if there was a spanMax and takeWhileMax but a generalized spanWith and takeWhileWith that also do a fold (in this case over the number of characters already selected by the predicate) seems to be the better choice to me.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions