(loop (cdr bvl)))
(if (identifier? bvl)
(procedure bvl)
- '()))))
\ No newline at end of file
+ '()))))
+
+;;; Aux is almost always the empty list.
+(define (make-lambda-list required optional rest aux)
+ (guarantee-list-of-unique-symbols required)
+ (guarantee-list-of-unique-symbols optional)
+ (if rest
+ (guarantee-symbol rest))
+ (guarantee-list-of-unique-symbols aux)
+ (let ((rest-aux-tail (if (not rest)
+ (if (null? aux)
+ '()
+ (cons lambda-tag:aux aux))
+ (if (null? aux)
+ rest
+ (cons* lambda-tag:rest rest
+ lambda-tag:aux aux)))))
+ (append required
+ (if (null? optional)
+ rest-aux-tail
+ (cons lambda-tag:optional
+ (append optional rest-aux-tail))))))
\ No newline at end of file
(lambda-components** value
(lambda (lambda-name required optional rest body)
(if (eq? lambda-name name)
- `(DEFINE (,name . ,(lambda-list required optional rest '()))
+ `(DEFINE (,name . ,(make-lambda-list required optional rest '()))
,@(with-bindings required optional rest
unsyntax-lambda-body body))
`(DEFINE ,name ,@(unexpand-binding-value value))))))
(lambda-components** expression
(lambda (name required optional rest body)
(collect-lambda name
- (lambda-list required optional rest '())
+ (make-lambda-list required optional rest '())
(with-bindings required optional rest
unsyntax-lambda-body body))))
(lambda-components expression
(lambda (name required optional rest auxiliary declarations body)
(collect-lambda name
- (lambda-list required optional rest auxiliary)
+ (make-lambda-list required optional rest auxiliary)
(let ((body (unsyntax-sequence body)))
(if (null? declarations)
body
(lambda-components** expression
(lambda (name required optional rest body)
name body
- (lambda-list required optional rest '()))))
-
-(define (lambda-list required optional rest auxiliary)
- (let ((optional (if (null? optional)
- '()
- (cons lambda-tag:optional optional)))
- (rest (cond ((not rest) '())
- ((null? auxiliary) rest)
- (else (list lambda-tag:rest rest)))))
- (if (null? auxiliary)
- `(,@required ,@optional . ,rest)
- `(,@required ,@optional ,@rest ,lambda-tag:aux ,@auxiliary))))
+ (make-lambda-list required optional rest '()))))
(define (lambda-components** expression receiver)
(lambda-components expression