-
Notifications
You must be signed in to change notification settings - Fork 105
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
Generalize continuous-subseqs #236
Labels
Comments
Could also use a special return value to indicate a particular value should be the last value in a subseq. This would allow something like |
jeff303
added a commit
to jeff303/specter
that referenced
this issue
Aug 14, 2020
Adding new subseq-pred-fn macro to create the new form of predicate function (taking the previous and current item), to preserve backward compatibility (still allowing predicate functions that only take the current item) Adding SubseqsDynamicPredFn, which works the same as SrangeEndFn, to support backward compatibility Adding wrapper to take a predicate on [prev current] and turn it into a predicate also taking the current index as the first param Creating transducer to combine this with the user-supplied predicate function Adding tests for select and transform WORK IN PROGRESS TODO: figure out how to make predicate function handle an open-ended subsequence (ex: end marker not yet seen)
jeff303
added a commit
to jeff303/specter
that referenced
this issue
Aug 14, 2020
Adding new subseq-pred-fn macro to create the new form of predicate function (taking the previous and current item), to preserve backward compatibility (still allowing predicate functions that only take the current item) Adding SubseqsDynamicPredFn, which works the same as SrangeEndFn, to support backward compatibility Adding wrapper to take a predicate on [prev current] and turn it into a predicate also taking the current index as the first param Creating transducer to combine this with the user-supplied predicate function Adding tests for select and transform WORK IN PROGRESS TODO: figure out how to make predicate function handle an open-ended subsequence (ex: end marker not yet seen)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of navigating to subsequences based on a simple predicate, could navigate based on
(fn [elem prev] ...)
.prev
would be the result of running the function on the previous value and would start atfalse
. Motivating use case is allowingcontinuous-subseqs
to handle cases like navigating to subseqs bounded by marker values, e.g.[:START 1 2 3 :END 5 6 7 :START 8 9 :END]
. Then this code could be used to remove those sections:For backwards compatibility should take same approach as
srange-dynamic
and makebounds-fn
macro to create functions forcontinous-subseqs
with the additionalprev
arg.The text was updated successfully, but these errors were encountered: