(declare (usual-integrations))
\f
-(define (scons-rule pattern procedure)
+(define (scons-rule patterns procedure)
(spar-call-with-values
(lambda (close . args)
(close-part close (apply procedure args)))
(spar-subform)
(spar-push spar-arg:close)
- (pattern->spar pattern)))
+ (top-level-patterns->spar patterns)))
(define-record-type <open-expr>
(make-open-expr procedure)
(apply $call list (map loop (cdr pattern))))
('('cons * form)
(apply $call cons (map loop (cdr pattern))))
+ ('('cons* * form)
+ (apply $call cons* (map loop (cdr pattern))))
('('call + form)
(apply $call (cadr pattern) (map loop (cddr pattern))))
('('subform * form)
(define (bad-pattern pattern)
(error:wrong-type-argument pattern "syntax-parser pattern" caller))
- (lambda (pattern)
- (if (not (list? pattern))
- (bad-pattern pattern))
- ($and (apply $and (map loop pattern))
- ($match-null))))))
+ loop)))
\f
(define (call-with-constructors expr? procedure)
(make-pattern-compiler #f 'pattern->spar))
(define-deferred pattern->spar-expr
- (make-pattern-compiler #t 'pattern->spar-expr))
\ No newline at end of file
+ (make-pattern-compiler #t 'pattern->spar-expr))
+
+(define (top-level-patterns->spar patterns)
+ (spar-and (apply spar-and (map pattern->spar patterns))
+ (spar-match-null)))
\ No newline at end of file