-
Notifications
You must be signed in to change notification settings - Fork 157
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
spanWith, takeWhileWith #362
Comments
The more general version maybe still is necessary if you want to do something more complicated though; I don't see a way to cobble it together out of existing library functions in a good way. |
Good to know, sad to hear though, but the discussion in that linked issue makes sense |
It would be nice to have a variant of
span
and a variant oftakeWhile
that do not just apply a predicate, but also fold over a value.The practical application I have in mind is to
span
ortakeWhile
but only up to a maximum number of characters. This of course could be implemented if there was aspanMax
andtakeWhileMax
but a generalizedspanWith
andtakeWhileWith
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.The text was updated successfully, but these errors were encountered: