Thu May 8 14:34:32 CEST 2008

loop bodies and delimited control

maybe today is not the day.. tired and stupid, i'm not worth much. but
i run into very strange results when trying shift/reset.

why don't these work?

 (define-word shift stack (shift k (cons k stack)))
 (define-word reset stack (reset stack))

reset actually doesn't install a prompt around a computation, because
'stack' will be evaluated before it is reached. it expands to
(call-with-continuation-prompt (lambda () stack))

what i need is a macro that does this. that is unfortunate, because
all code that uses it will need to be macros too. is that really true?

yes, looks like it is: otherwise the code gets evaluated before it's
passed to reset. looks like i need to play with evaluation order a
bit: instead of using strict evaluation, it might be easier to use

what about: every scat function takes a delayed computation?

it shouldn't be too difficult to change this in one place only:
wrapping each strict function so it becomes a lazy one.

(lambda (lazy-apply fn thunk)
  (lambda () (fn (thunk))))


  (delay (fn (force thunk)))