Forth Words Flashcards
(102 cards)
: xxx yyy ;
( – )
Creates a new definition with the name xxx, consisting of word or words yyy.
cr
( – )
Performs a carriage return and line feed at the current output device.
spaces
( n – )
Displays the given number of blank spaces.
space
( – )
Displays one blank space.
emit
( c – )
Transmits a character to the output device.
.” xxx”
( – )
Displays the character string xxx. The “ character terminates the string.
+
( n1 n2 – sum )
Adds.
.
( n – )
Displays a number, followed by one space.
( xxx)
( – )
Begins a comment that will be ignored by the text interpreter. The character ) is the delimiter.
-
( n1 n2 – diff )
Subtracts.
*
( n1 n2 – prod )
Multiplies.
/
( n1 n2 – quot )
Divides.
mod
( n1 n2 – n-rem )
Returns the remainder from division.
/mod
( n1 n2 – n-rem n-quot )
Divides. Returns the remainder and quotient.
swap
( n1 n2 – n2 n1 )
Reverses the top two stack items.
dup
( n – n n )
Duplicates the top stack item.
over
( n1 n2 – n1 n2 n1 )
Makes a copy of the second item and pushed it on top.
drop
( n – )
Discards the top stack item.
2swap
( d1 d2 – d2 d1 )
Reverses the top two pairs of numbers.
2dup
( d – d d )
Duplicates the top pairs of numbers.
2over
( d1 d2 – d1 d2 d1 )
Makes a copy of the second pair of numbers and pushes it on top.
2drop
( d – )
Discards the top pair of numbers.
if xxx else yyy then
if: ( ? – )
If ? is true, execute xxx; otherwise execute yyy. The phrase else yy is option.
=
( n1 n2 – ? )
Returns true if n1 and n2 are equal.