Thu Apr 10 21:33:38 EDT 2008

composable continuations

some simpler example is needed. suppose we're doing one prompt tag per

(define (one stack) (cons 1 stack))
(define (drop stack) (cdr stack))

(define (word: . fns)
  (apply compose (reverse fns)))

(define (broem stack extra)
  (define (mix s)
    (shift post
           (values (+ extra 1)
                   (post (cons extra s)))))

  (reset ((word: one mix one one) stack)))

getting tired.. what i want to do is basically: create a mechanism to
chop the code up in chunks that is compatible with continuations for
non-deterministic programming, so optimization can be implemented
using 'amb'.

what i sort of see is that it is possible to use shift and control to
chop up a program into different parts, and recompose them. in the
light of writing a RPN program (a b c) as (lambda (state) (c (b (a
state)))) this makes sense: shift can capture what happens AFTER a
certain point, upt to where the result is needed.

again.. i think i get what reset/shift do, but can't make the
connection to sidestepping threading. maybe i should try to translate
it to RPN first?