(define lambda-body)
(define set-lambda-body!)
(define lambda-bound)
+(define lambda-bound?)
(define lambda-interface)
(define lambda-name)
clambda-bound
clexpr-bound
xlambda-bound))
+ (set! lambda-bound?
+ (dispatch-1 'LAMBDA-BOUND?
+ clambda-bound?
+ clexpr-bound?
+ xlambda-bound?))
(set! lambda-immediate-body
(dispatch-0 'LAMBDA-IMMEDIATE-BODY
slambda-body
name
(append required (lambda-body-auxiliary body)))))
+(define (clambda-bound? clambda symbol)
+ (or (slambda-bound? clambda symbol)
+ (auxiliary-bound? (slambda-body clambda) symbol)))
+
(define (clambda-has-internal-lambda? clambda)
(lambda-body-has-internal-lambda? (slambda-body clambda)))
(and (internal-lambda? operator)
operator))))
+(define (auxiliary-bound? body symbol)
+ (and (combination? body)
+ (let ((operator (combination-operator body)))
+ (and (internal-lambda? operator)
+ (internal-lambda-bound? operator symbol)))))
+
(define clambda-wrap-body!)
(define clambda-wrapper-components)
(define clambda-unwrap-body!)
(slambda-auxiliary internal)
(lambda-body-auxiliary (slambda-body internal)))))))
+(define (clexpr-bound? clexpr symbol)
+ (or (slexpr-bound? clexpr symbol)
+ (clexpr-internal-bound? clexpr symbol)))
+
(define (clexpr-interface clexpr)
(slexpr-components clexpr
(lambda (name required body)
(or (lambda-body-has-internal-lambda? (slambda-body internal))
internal)))
+(define (clexpr-internal-bound? clexpr symbol)
+ (let ((body (slexpr-body clexpr)))
+ (and (combination? body)
+ (let ((operator (combination-operator body)))
+ (and (internal-lambda? operator)
+ (internal-lambda-bound? operator symbol))))))
+
(define (clexpr/physical-body clexpr)
(slambda-body (clexpr-has-internal-lambda? clexpr)))
(subvector->list names 1 (vector-length names)))
(lambda-body-auxiliary (%xlambda-body xlambda))))
+(define (xlambda-bound? xlambda symbol)
+ (guarantee-xlambda xlambda 'xlambda-bound?)
+ (or (let ((bound (%xlambda-names-vector xlambda)))
+ (subvector-find-next-element bound 1 (vector-length bound) symbol))
+ (auxiliary-bound? (%xlambda-body xlambda) symbol)))
+
(define (xlambda-has-internal-lambda? xlambda)
(lambda-body-has-internal-lambda? (&triple-first xlambda)))
#f
'())))
+(define (slambda-bound? slambda symbol)
+ (let ((bound (%slambda-names-vector slambda)))
+ (subvector-find-next-element bound 1 (vector-length bound) symbol)))
+
(define-integrable (%slambda-name slambda)
(vector-ref (%slambda-names-vector slambda) 0))
(define (slexpr-names-vector slexpr)
(&pair-cdr slexpr))
+(define (slexpr-bound? slexpr symbol)
+ (let ((bound (&pair-cdr slexpr)))
+ (subvector-find-next-element bound 1 (vector-length bound) symbol)))
+
(define-integrable (slexpr-name slexpr)
(vector-ref (&pair-cdr slexpr) 0))
(or (eq? (slambda-name *lambda) lambda-tag:internal-lambda)
(eq? (slambda-name *lambda) lambda-tag:internal-lexpr))))
+(define (internal-lambda-bound? *lambda symbol)
+ (and (slambda? *lambda)
+ (slambda-bound? *lambda symbol)))
+
(define (make-unassigned auxiliary)
(map (lambda (auxiliary)
auxiliary