2swap apply
; make-primitive apply
+: make-continuation
+ \ TODO: Capture parameter and return stacks in continuation
+;
+
+:noname ( args -- result )
+ make-continuation nil cons
+ 2swap apply
+
+; 1 make-fa-primitive call-with-current-continuation
+
\ }}}
\ ==== Miscellaneous ==== {{{
make-type symbol-type
make-type primitive-proc-type
make-type compound-proc-type
+make-type continuation-type
make-type port-type
: istype? ( obj type -- obj bool )
over = ;
['] evaluate-eproc goto
endof
+ continuation-type of
+ \ TODO: Apply continuation
+ endof
+
except-message: ." object '" drop print ." ' not applicable." recoverable-exception throw
endcase
;
: printcomp ( primobj -- )
2drop ." <compound procedure>" ;
+: printcont ( primobj --)
+ 2drop ." <continuation>" ;
+
: printnone ( noneobj -- )
2drop ." Unspecified return value" ;
pair-type istype? if ." (" printpair ." )" exit then
primitive-proc-type istype? if printprim exit then
compound-proc-type istype? if printcomp exit then
+ continuation-type istype? if printcont exit then
none-type istype? if printnone exit then
port-type istype? if printport exit then