Fri Mar 31 15:57:37 CEST 2006

temp code

Getting confused about temporary code again. What i need is to be able
to store temporary code on the return stack, to be able to use proper 
dynamic scope tricks without using global variables.

This can be done by
* compiling an anonymous function to the dictionary
* obtaining its xt
* popping the function from the dictionary
* storing it on the return stack

Using list-interpret is the easiest, but also requires list-interpret
to work. Since i want to use this to implement list-interpret, it
might be better to go another route. The latter is a lazy hack anyway.

The idea is: wrap a variable in an xt. For example, mimick this scheme
code without using permanent storage:

(define add-element (lst a)
     (map (lambda (x) (+ x a)) lst))

Just the lambda (accumulator) gives:

: make-accum # ( a -- xt code ) 
     mark ` xxx link enter, postpone
     literal postpone + postpone ; latestxt mark> ;

: make-accum
       ` xxx link enter,
       postpone literal
       postpone +
       postpone leave
       mark> ;

This seems to +- work for streams. Now i just need lists and string accepters.