;;; ;;; ;;; Bipartite Graph demonstartion ;;; ;;; ;; ;; Matcher definitions ;; (define $bipartite-graph (lambda [$a $b] (multiset (edge a b)))) (define $edge (lambda [$a $b] (algebraic-data-matcher {}))) ;; ;; Demonstration code ;; (define $bipartite-graph-data { }) (test (match-all bipartite-graph-data (bipartite-graph integer string) [ _> str])) (test (unique/m integer (match-all bipartite-graph-data (bipartite-graph integer string) [ ! _>>> n]))) (test (unique/m integer (match-all bipartite-graph-data (bipartite-graph integer string) [ ! _>>> n]))) (test (unique/m integer (match-all bipartite-graph-data (bipartite-graph integer string) [ _> n]))) (test (unique/m integer (match-all bipartite-graph-data (bipartite-graph integer string) [ _>> n]))) ;; I found bug on nested not-patterns ;(test (unique/m integer ; (match-all bipartite-graph-data (bipartite-graph integer string) ; [(& ; ; _>>> ; ! ; ! _>>) ; n]))) (test (unique/m integer (match-all bipartite-graph-data (bipartite-graph integer string) [ ! _>> n2])))