(%output-push output (%input-form input))
failure))
-(define (spar-push-value object)
+(define (spar-push-hist input senv output success failure)
+ (success (%null-input)
+ senv
+ (%output-push output (%input-hist input))
+ failure))
+
+(define (spar-push-senv input senv output success failure)
+ (success input
+ senv
+ (%output-push output senv)
+ failure))
+
+(define (spar-push-datum object)
(lambda (input senv output success failure)
- (declare (ignore input))
- (success (%null-input)
+ (success input
senv
(%output-push output object)
failure)))
(define (spar-push-thunk-value procedure)
(lambda (input senv output success failure)
- (declare (ignore input))
- (success (%null-input)
+ (success input
senv
(%output-push output (procedure))
failure)))
(%output-push output (procedure (%input-form input) senv))
failure)))
-(define (spar-push-classified procedure)
+(define (%push-classified procedure)
(lambda (input senv output success failure)
(success (%null-input)
senv
(define spar-discard-elt
(spar-elt spar-discard-form))
+(define spar-require-null
+ (spar-require-form null?))
+
(define spar-push-elt
(spar-elt spar-push-form))
+;;;; Environment combinators
+
+(define (spar-with-mapped-senv procedure . spars)
+ (let ((spar (%seq spars)))
+ (lambda (input senv output success failure)
+ (spar input
+ (procedure senv)
+ output
+ (lambda (input* senv* output* failure*)
+ (declare (ignore senv*))
+ (success input* senv output* failure*))
+ failure))))
+\f
(define spar-push-closed-form
(spar-push-mapped-full
(lambda (form senv)
(make-syntactic-closure senv '() form))))
+(define spar-push-closed-elt
+ (spar-elt spar-push-closed-form))
+
(define spar-push-partially-closed-form
(spar-push-mapped-full
(lambda (form senv)
(lambda (free)
(make-syntactic-closure senv free form)))))
-(define spar-push-closed-elt
- (spar-elt spar-push-closed-form))
-
(define spar-push-partially-closed-elt
(spar-elt spar-push-partially-closed-form))
-(define (spar-classify-elt procedure)
- (spar-elt (spar-push-classified procedure)))
+(define-deferred spar-push-classified-form
+ (%push-classified classify-form))
-(define (spar-match-elt predicate)
- (spar-elt (spar-require-form predicate)
- spar-push-form))
+(define-deferred spar-push-classified-elt
+ (spar-elt spar-push-classified-form))
-(define (spar-match-elt-full predicate)
- (spar-elt (spar-require-full predicate)
- spar-push-form))
+(define spar-push-deferred-classified-form
+ (%push-classified
+ (lambda (form senv hist)
+ (lambda ()
+ (classify-form form senv hist)))))
-;;;; Environment combinators
+(define spar-push-deferred-classified-elt
+ (spar-elt spar-push-deferred-classified-form))
-(define (spar-with-mapped-senv procedure . spars)
- (let ((spar (%seq spars)))
- (lambda (input senv output success failure)
- (spar input
- (procedure senv)
- output
- (lambda (input* senv* output* failure*)
- (declare (ignore senv*))
- (success input* senv output* failure*))
- failure))))
+(define spar-push-open-classified-form
+ (%push-classified
+ (lambda (form senv hist)
+ (declare (ignore senv))
+ (lambda (senv*)
+ (classify-form form senv* hist)))))
+
+(define spar-push-open-classified-elt
+ (spar-elt spar-push-open-classified-form))
+
+(define-deferred spar-push-id-elt
+ (spar-elt (spar-require-form identifier?)
+ spar-push-form))
+
+(define (spar-push-id-elt= id)
+ (spar-elt (spar-require-full
+ (lambda (form senv)
+ (and (identifier? form)
+ (identifier=? senv form senv id))))
+ spar-push-form))
\f
;;;; Value combinators
+(define (spar-push-values . spars)
+ (%with-output (lambda (output output*)
+ (%output-push output (%output-all output*)))
+ spars))
+
(define (spar-encapsulate-values procedure . spars)
(%encapsulate procedure spars))
senv*
(procedure output output*)
failure*))
- failure))))
\ No newline at end of file
+ failure))))
+
+(define spar-push-body
+ (spar-encapsulate-values
+ (lambda (elts)
+ (lambda (frame-senv)
+ (let ((body-senv (make-internal-senv frame-senv)))
+ (map-in-order (lambda (elt) (elt body-senv))
+ elts))))
+ (spar+ spar-push-open-classified-elt)
+ spar-require-null))
\ No newline at end of file