-
Notifications
You must be signed in to change notification settings - Fork 62
Add Iterable.takeUntil() or similar #5617
Comments
[@quintesse] Although I understand why you want this I personally feel it's wrong to use I'd rather have a boolean argument |
[@jvasileff] Yeah, I agree that There's a similar discussion here, with the following names suggested:
|
[@tombentley] Can this wait till 1.3? |
[@gavinking] Yes. (OTOH if someone can think of a decent name for it, it could be implemented in 5 mins.) In the absence of such a name I will reassign it. |
[@quintesse] The other option would be to introduce a |
[@gavinking] @quintesse interesting idea... |
[@jvasileff] IMO I almost adopted it for my project, but |
[@luolong] I second that. As for names, what about these:
The convention would be that methodes with (I have no idea what would be the use cases for |
[@quintesse] We had this (very long) discussion with Now if this was a common convention in other languages and everybody was accustomed to the idea perhaps.... maybe, just maybe, we could make a comparison with while loops vs do-until loops and make it easier to remember that way. Hmmm. |
[@FroMage] Sorry, wrong thread. I deleted my comment. |
[@jvasileff] The method:
would be similar to
takeWhile
, with the following differences:true
to signal the end of the stream, rather thanfalse
element
that caused the "stop" would be included in the resultant stream (takeWhile
discards the "final" element).This is useful if your goal is to take all elements up to and including the "element you are looking for".
found
could also be used as the name for the passed in function.[Migrated from ceylon/ceylon.language#739]
The text was updated successfully, but these errors were encountered: