Paste: book example

Author: rien
Mode: factor
Date: Thu, 15 Dec 2011 08:15:04
Plain Text |
input: 1
stack: 1
moral: every value goes into the datastack.
       the datastack is usually called "the stack".
       1 will sit there until something is done to it.

input: 2
stack: 1 2
moral: the stack is like a real-world stack: cumulative.
       the stack can hold many items.
       the rightmost item is the top of the stack.
       "top of stack" is commonly shortened to TOS.
       TOS also means "the item on the top of the stack".

input: +
stack: 3
moral: + is a function that takes two numbers, adds them up and places the result on the stack.
       functions in Factor are called "words", and libraries are "vocabularies" (short: vocabs)
       ordinary words expect their arguments on the stack.
       the + word takes 2 items from the stack and returns 1 item on the stack.

New Annotation

Summary:
Author:
Mode:
Body: