The Lambda Lab
/
projects
/
scheme.forth.jl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9f67194
)
Fixed TCO bug.
author
Tim Vaughan
<tgvaughan@gmail.com>
Mon, 25 Jul 2016 11:04:23 +0000
(23:04 +1200)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Mon, 25 Jul 2016 11:05:23 +0000
(23:05 +1200)
defer-is.4th
patch
|
blob
|
history
scheme.4th
patch
|
blob
|
history
diff --git
a/defer-is.4th
b/defer-is.4th
index
3949d0c
..
ac82c90
100644
(file)
--- a/
defer-is.4th
+++ b/
defer-is.4th
@@
-37,8
+37,5
@@
hide abort-defer
\ Need this for tail call optimization
\ Need this for tail call optimization
-: goto ( cfa -- )
- R> drop execute ;
-
-: goto-prime ( cfa -- )
- R> R> 2drop execute ;
+: goto-deferred ( cfa -- )
+ R> drop >body @ >body >R ;
diff --git
a/scheme.4th
b/scheme.4th
index
1f2111a
..
8bc44d3
100644
(file)
--- a/
scheme.4th
+++ b/
scheme.4th
@@
-3,6
+3,11
@@
scheme definitions
include term-colours.4th
include defer-is.4th
include term-colours.4th
include defer-is.4th
+include catch-throw.4th
+
+defer read
+defer eval
+defer print
\ ------ Types ------
\ ------ Types ------
@@
-376,8
+381,6
@@
include scheme-primitives.4th
\ ---- Read ---- {{{
\ ---- Read ---- {{{
-defer read
-
variable parse-idx
variable stored-parse-idx
create parse-str 161 allot
variable parse-idx
variable stored-parse-idx
create parse-str 161 allot
@@
-785,8
+788,6
@@
parse-idx-stack parse-idx-sp !
\ ---- Eval ---- {{{
\ ---- Eval ---- {{{
-defer eval
-
: self-evaluating? ( obj -- obj bool )
boolean-type istype? if true exit then
fixnum-type istype? if true exit then
: self-evaluating? ( obj -- obj bool )
boolean-type istype? if true exit then
fixnum-type istype? if true exit then
@@
-981,8
+982,7
@@
defer eval
2drop ( env body )
car 2swap ( exp env )
2drop ( env body )
car 2swap ( exp env )
- ['] eval goto-prime \ Tail call optimization
- \ eval \ No tail call optimization
+ R> drop ['] eval goto-deferred \ Tail call optimization
endof
bold fg red ." Object not applicable. Aboring." reset-term cr
endof
bold fg red ." Object not applicable. Aboring." reset-term cr
@@
-1030,7
+1030,8
@@
defer eval
if-alternative
then
if-alternative
then
- 2swap ['] eval goto
+ 2swap
+ ['] eval goto-deferred
then
lambda? if
then
lambda? if
@@
-1058,8
+1059,6
@@
defer eval
\ ---- Print ---- {{{
\ ---- Print ---- {{{
-defer print
-
: printnum ( numobj -- ) drop 0 .R ;
: printbool ( numobj -- )
: printnum ( numobj -- ) drop 0 .R ;
: printbool ( numobj -- )