diff options
author | Preston Pan <preston@nullring.xyz> | 2024-01-26 13:20:50 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2024-01-26 13:20:50 -0800 |
commit | 0dc42e44798326003673b93153b76e8540e360ee (patch) | |
tree | 60cd675454230c0f9d7bd5631ed5d8dd6fe0a964 | |
parent | 292c5f83bed9531e5eacd2fe0ff1dd5ac2e84b94 (diff) |
add blog post
-rw-r--r-- | blog/stem.org | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/blog/stem.org b/blog/stem.org index a467e88..17820cd 100644 --- a/blog/stem.org +++ b/blog/stem.org @@ -230,6 +230,7 @@ on the stack back after, with the value at that index on top. There are two more #+begin_src stem :exports both 1 2 swap . . 1 2 . . +"hello\n" dup . . 1 2 5 [ + ] dip . . #+end_src @@ -238,10 +239,13 @@ on the stack back after, with the value at that index on top. There are two more : 2 : 2 : 1 +: hello +: hello : 5 : 3 -~swap~ just swaps the top two numbers on the stack, and ~dip~ is just ~eval~ except it does the operation one layer below. In this example, it adds 1 and 2 +~swap~ just swaps the top two numbers on the stack, ~dup~ just duplicates the top of the stack, +and ~dip~ is just ~eval~ except it does the operation one layer below. In this example, it adds 1 and 2 instead of 2 and 5, thus you see a 5 and a 3 printed instead. Note that there are more words, but we won't need them for now. Now, we are ready to investigate how to define words in terms of other words, or so-called /compound words/. |