Currently, grounded atoms can have custom match_, but it works for atoms themselves, while it would be useful for operations to handle their arguments in match_ as well. For example, (+ $x 1) could handle matching against 5 inferring a binding $x <- 4. Similarly, cons-atom could be used for deconstruction, e.g. (cons-atom $car $cdr) matched against (a b c) would yield bindings $car <- a, $cdr <- (b c), so one could write
Currently, grounded atoms can have custom
match_
, but it works for atoms themselves, while it would be useful for operations to handle their arguments inmatch_
as well. For example,(+ $x 1)
could handle matching against5
inferring a binding$x <- 4
. Similarly,cons-atom
could be used for deconstruction, e.g.(cons-atom $car $cdr)
matched against(a b c)
would yield bindings$car <- a
,$cdr <- (b c)
, so one could writeinstead of
in recursive analysis of expressions.
It is generally not useful to have a custom match for operations without arguments.