From 050690181a362f474847eca50030732180245d4a Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Fri, 21 Jul 2023 10:42:04 -0700 Subject: [PATCH] (fib.tal) Housekeeping --- projects/examples/exercises/fib.tal | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/projects/examples/exercises/fib.tal b/projects/examples/exercises/fib.tal index b6085c8..cf2a73b 100644 --- a/projects/examples/exercises/fib.tal +++ b/projects/examples/exercises/fib.tal @@ -20,18 +20,18 @@ @fib ( num* -- numfib* ) #0001 GTH2k ?&>ok POP2 JMP2r &>ok - ( a ) SUB2k fib STH2 - ( b ) INC2 SUB2 fib STH2r - ( res ) ADD2 JMP2r + SUB2k fib STH2 + INC2 SUB2 fib STH2r + ADD2 JMP2r ( @|tail-recursive ) @fibr ( a* b* num* -- a* b* numfib* ) - DUP2 #0001 NEQ2 ?&>no-1 - POP2 DUP2 JMP2r &>no-1 - ( a ) #0001 SUB2 STH2 - ( b ) SWP2 ADD2k NIP2 STH2r !fibr + #0001 NEQ2k ?&>no-1 + POP2 POP2 DUP2 JMP2r &>no-1 + SUB2 STH2 + SWP2 OVR2 ADD2 STH2r !fibr ( @|stdlib )