Created
July 9, 2019 15:16
-
-
Save disconcision/5c80494531f7ae0b8c5ac5980ffc0395 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this is regarding this expander: | |
https://github.com/disconcision/containment-patterns | |
which I am trying to improve | |
simple containment patterns (finds first instance of internal pattern): | |
(match '(1 (5 ($ 3 6)) 7) | |
[(⋱ c `($ ,x ,y)) | |
(⋱ c `($, (+ x y)))]) | |
> '(1 (5 ($ 9)) 7) | |
multi-hit patterns (my current syntax): | |
(match '(1 (5 ($ 3 6)) 7 ($ 5 9)) | |
[(⋱+ c `($ ,x ,y)) | |
(⋱+ c [x y] `($, (+ x y)))]) | |
> '(1 (5 ($ 9)) 7 ($ 14)) | |
but I just want to write: | |
(match '(1 (5 ($ 3 6)) 7 ($ 5 9)) | |
[(⋱+ c `($ ,x ,y)) | |
(⋱+ c `($, (+ x y)))]) | |
the way i am currently thinking of doing this is capturing the identifiers bound in the internal pattern (in above example, [x y]), and then communicating them to the template. i can do the former but not the latter. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment