commit 050690181a362f474847eca50030732180245d4a parent 98a0c7d6094c08a689589bed707692967ec9bcd0 Author: Devine Lu Linvega <aliceffekt@gmail.com> Date: Fri, 21 Jul 2023 10:42:04 -0700 (fib.tal) Housekeeping Diffstat:
M | 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 @@ -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 )