From: Tim Vaughan Date: Fri, 22 Jul 2016 08:24:41 +0000 (+1200) Subject: Added tail-call optimization. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=d42b0088f674ffdcd607016213c66455864b7588;p=scheme.forth.jl.git Added tail-call optimization. --- 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