summaryrefslogtreecommitdiffhomepage
path: root/forth.html.markdown
diff options
context:
space:
mode:
authorHorseMD <alightedness@gmail.com>2014-11-13 00:19:20 +0000
committerHorseMD <alightedness@gmail.com>2014-11-13 00:19:20 +0000
commitba3bc070c5db0b24f485a1a742c0b3944b3bb7e8 (patch)
tree6bc94455d59d98ebf78be28cdc8c46f042a50780 /forth.html.markdown
parente5fbd94af0455cfcac15e398c41a0686b69d38ec (diff)
Improve section Advanced Stack Manipulation's examples.
Diffstat (limited to 'forth.html.markdown')
-rw-r--r--forth.html.markdown10
1 files changed, 5 insertions, 5 deletions
diff --git a/forth.html.markdown b/forth.html.markdown
index 91591ac9..c61633c2 100644
--- a/forth.html.markdown
+++ b/forth.html.markdown
@@ -52,7 +52,7 @@ of what is written here should work elsewhere.
\ And so on.
-\ ------------------------------ Stack Maniulation ------------------------------
+\ ------------------------------ Stack Manipulation ------------------------------
\ Naturally, as we do so much work with the stack, we'll want some useful methods.
@@ -63,10 +63,10 @@ of what is written here should work elsewhere.
\ ------------------------------ More Advanced Stack Manipulation ------------------------------
-tuck \ acts like dup, except it duplicates the top item into the 3rd* position in the stack
-over \ duplicate the second item to the top of the stack
-n roll \ where n is a number, *move* the stack item at that position to the top of the stack
-n pick \ where n is a number, *duplicate* the item at that position to the top of the stack
+1 2 3 4 tuck \ duplicate the top item into the second slot: 1 2 4 3 4 ok
+1 2 3 4 over \ duplicate the second item to the top: 1 2 3 4 3 ok
+1 2 3 4 2 roll \ *move* the item at that position to the top: 1 3 4 2 ok
+1 2 3 4 2 pick \ *duplicate* the item at that position to the top: 1 2 3 4 2 ok
\ When referring to stack indexes, they are zero-based.