static S snlApply(S snl, Map matches) { ret snlFromTree(snlApply(snlToTree(snl), matches)); } static Lisp snlApply(Lisp tree, Map matches) { if (tree == null) ret null; if (tree.isEmpty()) ret or(matches.get(tree.head), tree); Lisp lisp = new Lisp(tree.head); for (Lisp child : tree) lisp.add(snlApply(child, matches)); ret lisp; }