Added tail-call optimization.
authorTim Vaughan <tgvaughan@gmail.com>
Fri, 22 Jul 2016 08:24:41 +0000 (20:24 +1200)
committerTim Vaughan <tgvaughan@gmail.com>
Fri, 22 Jul 2016 08:24:41 +0000 (20:24 +1200)
defer-is.4th
scheme.4th

index 1b171b6..3949d0c 100644 (file)
@@ -40,3 +40,5 @@ hide abort-defer
 : goto ( cfa -- )
     R> drop execute ;
 
+: goto-prime ( cfa -- )
+    R> R> 2drop execute ;
index cecacff..893b20b 100644 (file)
@@ -981,7 +981,8 @@ defer eval
                 2drop ( env body )
                 car 2swap ( exp env )
 
-                eval \ TODO: tail call optimization
+                ['] eval goto-prime  \ Tail call optimization
+                \ eval               \ No tail call optimization
             endof
 
             bold fg red ." Object not applicable. Aboring." reset-term cr