parameter object may also be assigned by passing it an argument. Note
that an assignment to a settable parameter affects only the extent of
its current binding.
+
+@code{make-settable-parameter} is an MIT/GNU Scheme extension.
@end deffn
@deffn procedure parameterize* bindings thunk
dynamically bound to the values.
Note that the @code{parameterize} special form expands into a call to
-this procedure.
+this procedure. @code{parameterize*} is an MIT/GNU Scheme extension.
@end deffn
@anchor{Cells}
@example
@group
(define (complicated-dynamic-parameter)
- (let ((variable (make-parameter 1))
+ (let ((variable (make-settable-parameter 1))
(inside-continuation))
(write-line (variable))
(call-with-current-continuation
\f
(define-test 'PARAMETERS
(lambda ()
+ (assert-eqv make-unsettable-parameter make-parameter)
(let ((p (make-parameter 1))
- (q (make-parameter 2 (lambda (v)
- (if (not (integer? v))
- (error:wrong-type-argument v "an integer"
- 'PARAMETER-Q)
- v)))))
+ (q (make-parameter 2
+ (lambda (v)
+ (guarantee-exact-nonnegative-integer v)
+ v))))
(assert-eqv (p) 1)
- (assert-equal (parameterize ((p "7") (q 9)) (cons (p) (q)))
+ (assert-equal (parameterize ((p "7") (q 9))
+ (cons (p) (q)))
'("7" . 9))
(assert-equal (cons (p) (q))
'(1 . 2))
- (assert-error (lambda () (parameterize ((q "7")) (q)))
+ (assert-error (lambda ()
+ (parameterize ((q "7"))
+ (q)))
(list condition-type:wrong-type-argument)))))
;; From node "Dynamic Binding" in doc/ref-manual/special-forms.texi:
(define (complicated-dynamic-parameter)
- (let ((variable (make-parameter 1))
+ (let ((variable (make-settable-parameter 1))
(inside-continuation))
(write-line (variable))
(call-with-current-continuation