Better way to accumulate? added by DeeEff on Fri Jul 10 17:13:27 2015
(define (graph-match G1 G2)
(let ([matchings (make-set)])
(let match-loop ([s (make-set)])
(cond
[(set= (set-map cdr s)
(graph-vertices G2))
(set-add! s matchings)]
[else (for-each (lambda (vertex-pair)
(let ([n (car vertex-pair)]
[m (cdr vertex-pair)])
(when (and (syntactic-feasibility? s n m)
(semantic-feasibility? s n m))
(match-loop (set-union s (cons n m))))))
(candidate-pairs s G1 G2))]))
(set->list matchings)))