From d42b0088f674ffdcd607016213c66455864b7588 Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Fri, 22 Jul 2016 20:24:41 +1200 Subject: [PATCH] Added tail-call optimization. --- defer-is.4th | 2 ++ scheme.4th | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/defer-is.4th b/defer-is.4th index 1b171b6..3949d0c 100644 --- a/defer-is.4th +++ b/defer-is.4th @@ -40,3 +40,5 @@ hide abort-defer : goto ( cfa -- ) R> drop execute ; +: goto-prime ( cfa -- ) + R> R> 2drop execute ; diff --git a/scheme.4th b/scheme.4th index cecacff..893b20b 100644 --- a/scheme.4th +++ b/scheme.4th @@ -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 -- 2.20.1