[<<][plt][>>][..]
Sun Sep 6 12:07:52 CEST 2009

Param -> pure functions using delimited continuations

For the general principle see [1].  This post is more concerned with
finding a nice abstraction.  Leaving out some steps I arrive at:

(define-syntax-rule (shift/parameters parameters k . expr)
  (let ((ps (list . parameters)))
    (apply (lambda (x . pvs)
             (for ((p ps) (pv pvs)) (p pv))
             x)
           (let ((pvs (for/list ((p ps)) (p))))
             (shift _k
               (let ((k (lambda (x) (_k (cons x pvs)))))
                 expr))))))

This saves all parameters from dynamic to lexical context before
continuation capture and restores them at invokation.


[1] entry://../compsci/20090906-105507



[Reply][About]
[<<][plt][>>][..]