-
-
Save 0x0dea/0e581e84658dc339d253 to your computer and use it in GitHub Desktop.
Memoized Tribonacci function in Whitespace assembly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0: push 0 dup inum load | |
dup jn 5 dup | |
push 0 dup store | |
1: dup jz 2 | |
dup push -1 store | |
push 1 sub jump 1 | |
2: dup store | |
push 1 dup store | |
push 2 push 1 store | |
call 3 onum push 10 ochr jump 0 | |
3: dup load jn 4 load ret | |
4: dup dup dup | |
push 1 sub call 3 swap | |
push 2 sub call 3 add swap | |
push 3 sub call 3 add swap | |
copy 1 store ret | |
5: pop exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment