X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;f=src%2Fscheme-primitives.4th;h=dbb68bc63aa56f57386a9b9d7c96eadcd4558cff;hb=c775ab2562b213ac96fe1803d4e7001a73e874a8;hp=1e37e0d5bd3e20451ff21e355a72b730abfab3da;hpb=5c89ece636005a3008eb27a80b0c805b4d0e4c84;p=scheme.forth.jl.git diff --git a/src/scheme-primitives.4th b/src/scheme-primitives.4th index 1e37e0d..dbb68bc 100644 --- a/src/scheme-primitives.4th +++ b/src/scheme-primitives.4th @@ -280,6 +280,13 @@ drop swap drop f> boolean-type ; 2 make-fa-primitive flo:> +:noname ( flonum flonum -- bool ) + drop swap drop f<= boolean-type +; 2 make-fa-primitive flo:<= + +:noname ( flonum flonum -- bool ) + drop swap drop f>= boolean-type +; 2 make-fa-primitive flo:>= :noname ( flonum -- bool ) drop 0.0 = boolean-type @@ -594,12 +601,32 @@ defer display :noname ( args -- result ) 2dup car 2swap cdr - + nil? false = if car then ( proc argvals ) - - apply + + 2swap apply ; make-primitive apply +:noname ( proc -- result ) + make-continuation + + ( Note that we get to this point either when + make-continuation is originally called or when + restore-continuation is called. Since we don't + want to call proc again following a restore, + we use the boolean values placed on the parameter + stack by make-continuation and restore-continuation + to detect which call got us here and act accordingly. ) + + drop if + nil cons + 2swap apply + else + 2swap 2drop + then + +; 1 make-fa-primitive call-with-current-continuation + \ }}} \ ==== Miscellaneous ==== {{{ @@ -611,12 +638,15 @@ defer display nil? if ." Error." else - ." Error: " - - begin - 2dup car print - cdr nil? - until + ." Error:" + + 2dup car space display + cdr nil? invert if + begin + 2dup car space print + cdr nil? + until + then 2drop then