gestalt-union*

This commit is contained in:
Tony Garnock-Jones 2014-06-22 22:03:09 -04:00
parent 244e793d03
commit feaffaa752
1 changed files with 9 additions and 3 deletions

View File

@ -25,6 +25,7 @@
simple-gestalt
gestalt-empty
gestalt-empty?
gestalt-union*
gestalt-union
gestalt-filter
gestalt-match
@ -263,9 +264,9 @@
(cons (matcher-combiner (car sa1) (car sa2))
(matcher-combiner (cdr sa1) (cdr sa2))))))
;; Gestalt* -> Gestalt
;; Computes the union of its arguments.
(define (gestalt-union . gs)
;; (Listof Gestalt) -> Gestalt
;; Computes the union of the given gestalts.
(define (gestalt-union* gs)
(if (null? gs)
(gestalt-empty)
(let walk ((gs gs))
@ -273,6 +274,11 @@
[(list g) g]
[(cons g rest) (gestalt-union1 g (walk rest))]))))
;; Gestalt* -> Gestalt
;; Computes the union of its arguments.
(define (gestalt-union . gs)
(gestalt-union* gs))
;; Gestalt Gestalt -> Gestalt
;; Computes the union of its arguments.
(define (gestalt-union1 g1 g2) (gestalt-combine-straight g1 g2 (lambda (side x) x) matcher-union))