-
Notifications
You must be signed in to change notification settings - Fork 8
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
Implement TaskSeq.skipWhile
, skipWhileAsync
, skipWhileInclusive
and skipWhileInclusiveAsync
#219
Conversation
… and `skipWhileInclusiveAsync`
b9d62a6
to
0b25ccd
Compare
@bartelink, in case you have some time, I can use an extra pair of eyes here (meanwhile, I'll fix the failing tests). |
3cfecd3
to
8567f34
Compare
7af6d9a
to
17aa445
Compare
7802df6
to
0aa0742
Compare
…nd for clarity (tx @bartelink)
@bartelink thanks for the extensive review, much appreciated! I applied all your comments, insofar they were still applicable after some other changes. |
Almost forgot to update the readmes and release notes, oops! |
re that use case... the example you have feels more like you are picturing a scan until or something if you want to skip while some condition and then skip one more, that's not going to help you show the extra one you skipped is there some partition function of some kind that this might make sense as? such a thing could split a list into 3 over some pivot or something? |
for I am searching until I find something It does not particularly lend itself to showing the failing one, as the final item can either simply be the last item in the list In completely concrete terms, I'm searching backward through a list of events until I meet either a) a Snapshot b) a Reset event or c) the end of the list |
Oh yeah, I deleted my "use case" shortly after posting it. But here's one:
Yep, a bit contrived, for sure. I'm sure other use cases will come up, or not... |
so you have a list with pairs of items and when you see the first one, you want to skip its partner ultimately the reason why takeWhileInclusive does make sense is that it's all about the single item being tested - do you want the final one or not also not wanting the one after that you're not even going to look at before discarding implicitly is not a logical inverse of that (See above about windowing/partitioning/having a pivot item - SkipWhileInclusive is ultimately very baroque and I'm not seeing any real example - maybe if you can find one in the wild (or any prior art / discussion of this logical duality), that would help?) |
Yeah, that's gonna be hard. Just like with |
Some things I missed from review comments go in #220. |
Fixes #130 (edit: see also #235)
Part of the push for implementing low-hanging from as listed in #208. Implements the following signatures:
Note that
inclusive
here means that it skips at least one item (i.e., the modifier applies to the action of skipping). This is analogous to howtakeWhileInclusive
etc work.Some explanation may be warranted for future reference. Here's a truth table of
1..10
and a filter function offilter x = x < 5
for bothinclusive
andnon-inclusive
skip functions (also applies totake
functions):skipWhile
skipWhileInclusive
TODO list:
TaskSeq.skipWhile
TaskSeq.skipWhileAsync
TaskSeq.skipWhileInclusive
TaskSeq.skipWhileInclusiveAsync