parameterize

Joo ChurlSoo <[email protected]> Thu, 13 Jan 2011 08:18:20 +0100
Newsgroups gmane.lisp.scheme.scheme48
Message-ID <[email protected]>
The following seems to be a bug.

> ,open srfi-39
> 
(let ((f (make-parameter 'a))
      (path '())
      (g (make-parameter 'g))
      (c #f))
  (let ((add (lambda () (set! path (cons (f) path)))))
    (add)
    (parameterize ((f 'b)
		   (g (call-with-current-continuation (lambda (c0) (set! c c0) 'c))))
	(add) (f (g)) (add))
    (f 'd)
    (add)
    (if (< (length path) 5)
	(c 'e)
	(reverse path))))
'(a b c d c e d)			;(a b c d b e d)
> ;; cf.
(let ((f (make-parameter 'a))
      (path '())
      (g (make-parameter 'g))
      (c #f))
  (let ((add (lambda () (set! path (cons (f) path)))))
    (add)
    (parameterize ((f 'b))
	(g (call-with-current-continuation (lambda (c0) (set! c c0) 'c)))
	(add) (f (g)) (add))
    (f 'd)
    (add)
    (if (< (length path) 5)
	(c 'e)
	(reverse path))))
'(a b c d c e d)
> 
-- 
Joo ChurlSoo