From: Chris Hanson Date: Wed, 13 Jun 2018 03:10:50 +0000 (-0700) Subject: Define parameterize using syntax-rules and add it to the host adapter. X-Git-Tag: mit-scheme-pucked-9.2.15~11^2~1 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=a877627231608cfecea5a789062a0d1bd2ba670c;p=mit-scheme.git Define parameterize using syntax-rules and add it to the host adapter. --- diff --git a/src/runtime/host-adapter.scm b/src/runtime/host-adapter.scm index 28572f67b..a3b7b3873 100644 --- a/src/runtime/host-adapter.scm +++ b/src/runtime/host-adapter.scm @@ -102,6 +102,14 @@ USA. (delay-force (make-promise expression)))))) env)) + (if (unbound? env 'parameterize) + (eval '(define-syntax parameterize + (syntax-rules () + ((parameterize ((param value) ...) form ...) + (parameterize* (list (cons param value) ...) + (lambda () form ...))))) + env)) + (if (unbound? env 'define-print-method) (eval '(define (define-print-method predicate print-method) unspecific) diff --git a/src/runtime/mit-macros.scm b/src/runtime/mit-macros.scm index e3041528e..c96542ee9 100644 --- a/src/runtime/mit-macros.scm +++ b/src/runtime/mit-macros.scm @@ -187,24 +187,6 @@ USA. (apply scons-begin (map scons-set! ids vals)) (scons-call (apply scons-lambda '() body-forms))))))))) -(define $parameterize - (spar-transformer->runtime - (delay - (scons-rule - `((subform (* (subform (list id any)))) - (+ any)) - (lambda (bindings body-forms) - (let ((ids (map car bindings)) - (vals (map cadr bindings))) - (scons-call (scons-close 'parameterize*) - (apply scons-call - (scons-close 'list) - (map (lambda (id val) - (scons-call (scons-close 'cons) id val)) - ids - vals)) - (apply scons-lambda '() body-forms)))))))) - ;;; SRFI 2: and-let* ;;; The SRFI document is a little unclear about the semantics, imposes @@ -406,6 +388,12 @@ USA. ((delay expression) (delay-force (make-promise expression))))) +(define-syntax $parameterize + (syntax-rules () + ((parameterize ((param value) ...) form ...) + (parameterize* (list (cons param value) ...) + (lambda () form ...))))) + (define $guard (spar-transformer->runtime (delay