100 putn
'a putc
"hello, world" puts
1 2 3 "%d - %d = %d\n" puts "Charles" "Hello %s\n" puts
getc
"this is a string" " this string has leading and trailing whitespace "
getToken
'c accept tib
getNumber
2 3 =
3 4 <>
3 4 >
3 4 <
3 4 >=
3 4 <=
"hello" "world" compare
"hello" "world" compare not
1 2 = [ "true" ] [ "false" ] if 1 2 = [ "true" ] ifTrue 1 2 = [ "false" ] ifFalse
[ @base [ 8 = ] [ "octal" ] whend [ 10 = ] [ "decimal" ] whend [ 16 = ] [ "hexadecimal" ] whend drop ( default case ) ] do [ @base [ 8 = ] [ "base is octal: %d" puts ] when [ 10 = ] [ "base is decimal: %d" puts ] when drop ( default case ) ] do
[ ( code ) ]
Quotes can be nested.
: name ( stack comment ) ( code ) ;
Quotes can be nested inside a named function.
repeat ( code ) again
Conditional loops are generally preferable.
( simple, no index on stack ) 10 [ 'a putc ] times ( index on stack, counts up ) 10 [ putn ] iter ( index on stack, counts down ) 10 [ putn ] iterd
10 [ 1- dup putn dup 0 <> ] while
100 200 +
400 32 -
98 12 *
200 4 /
203 4 mod
Raise 3 to the second power.
3 2 pow
-76 abs
34 8 min 34 8 max
chain: name' ... contents ... ;chain
Vocabulary names should end in a single apostrophe.
with name' with| name' and' more' names' |
( remove the most recently added vocabulary ) without ( remove all vocabularies ) global
^vocabulary'function