3 ms·
> What are your thoughts on implementing reversible patterns? I'm thinking something like this (defprotocol Pattern (extract [this input] "=> bindin
by jamii 14y ago
> What are your thoughts on implementing reversible patterns?
I'm thinking something like this
(defprotocol Pattern
(extract [this input] "=> bindings")
(replace [this input bindings] "=> new-input"))
This should obey some rule like:
(submap? (extract p (replace p input bindings)) bindings)
That would make the data-grammar/generic-traversal experiments much nicer and also cleanly delineates patterns from views. It may also help when I try to do things like generative testing.
Not quite sure how that would work for (or ...) and (not ...) patterns, so it still needs more hammock time.