diff options
-rw-r--r-- | index.org | 11 | ||||
-rw-r--r-- | mindmap/recursion.org | 30 |
2 files changed, 6 insertions, 35 deletions
@@ -62,19 +62,10 @@ website: #+begin_src shell :exports code :results silent cd ~/org/website git add . -git commit -m "add more information for about site" +git commit -m "edit recursion article mindmap" git push github main rsync -azvP ~/website_html/ root@nullring.xyz:/var/www/ret2pop/ #+end_src -#+RESULTS: -| [main | 3f83226] | is | my | website | fixed? | | | | | | | -| 1 | file | changed, | 4 | insertions(+), | 4 | deletions(-) | | | | | | -| sending | incremental | file | list | | | | | | | | | -| index.html | | | | | | | | | | | | -|
| 1,400 | 10% | 0.00kB/s | 0:00:00 |
| 13,211 | 100% | 11.26MB/s | 0:00:00 | (xfr#1, | to-chk=91/102) | -| | | | | | | | | | | | | -| sent | 3,964 | bytes | received | 154 | bytes | 1,647.20 | bytes/sec | | | | | -| total | size | is | 1,868,773 | speedup | is | 453.81 | | | | | | No, seriously, this is how I update my website. This code block right here. That's right, this website will be filled with code blocks that both act as /examples/ of how the website might be maintained, but also run the commands themselves. diff --git a/mindmap/recursion.org b/mindmap/recursion.org index bfedaca..3cc2a12 100644 --- a/mindmap/recursion.org +++ b/mindmap/recursion.org @@ -102,32 +102,12 @@ results block of this one, and you can see an exact mirroring of the first block So, the "going down" procedure is the same thing as pushing values onto some sort of stack, and the "going back up" procedure is exactly the same as popping those values off a stack! -** Computer Hardware Describes Recursion -Even though we can analogize pushing and popping off the stack to this recursion, there still isn't a clear definite -link to the two ideas in hardware. Therefore, I will do a demonstration using assembly. - -To start with, we will be comparing an assembly function that takes the factorial to this one in C: -#+begin_src C :results output :exports both -#include <stdio.h> - -int factorial(int x) { - if (x < 0) return -1; - else if (x == 0) return 1; - return x * factorial(x - 1); -} -int main(int argc, char **argv) { - printf("factorial of five: %d\n", factorial(5)); - return 0; -} +** Stacks Describe Recursion +To see more transparently how stacks relate to recursion, we use my programming language stem, which is a +concatenative programming language, as a more transparent example. +#+begin_src stem +factorial [ dup 0 <= [ 1 + ] [ dup 1 - factorial * ] ] def #+end_src - -#+RESULTS: -: factorial of five: 120 - -Because C is a compiled language, it is easier to see what is actually happening human-wise. However, -we will need to write and analyze some assembly in order to figure out what is actually going on. - -Assembly language section coming soon! We will be using NASM due to its readability. * TODO Recursion Describes…? * TODO Recursion is not Recursive |