(define $b-tree (lambda [$a] (algebraic-data-matcher { }))) (define $n-tree (lambda [$a] (matcher {[,$val [] {[$tgt (match [val tgt] [(n-tree a) (n-tree a)] {[[ ] {[]}] [[_ _] {}]})]}] [ [a (list (n-tree a))] ; Node whose children are seen as a list. {[ {[x ts]}] [_ {}]}] [ [a (multiset (n-tree a))] ; Node whose children are seen as a multiset. {[ {[x ts]}] [_ {}]}] [ [(n-tree a)] {[$t {t @(match-all t (n-tree a) [ _>> x])}]}] [$ [something] {[$tgt {tgt}]}] })))