KISS . KISS EMIT
. 3 \ 3
. ( 3 + 4 * 5 ) \ 35
Nesting is allowed (12 levels deep):
. ( 3 + ( 4 * 5 ) )
. ( ( 3 + 4 ) * 5 )
Mixing with other Forth commands is no problem:
. BASE \ 291976 (at least one Forth)
. ( BASE @ ) \ 10 (parentheses needed!)
. ( BASE @ 1+ ) \ 11
BASE . ( @ 1+ ) \ 11
BASE @ . 1+ \ 11
. ( BASE @ + 5 ) \ 15
BASE . ( @ + 6 ) \ 16
BASE @ . ( + 7 ) \ 17
Undoubtedly many more variants are possible.
. ( 9 + DUP ) \ 18
. ( 1 20 - SWAP ) \ 19
Incredibly flexible, no doubt, but
easier?
Let's explore even further
KISS > KISS < KISS = KISS <>
KISS IF KISS THEN
KISS AND
: TEST (( x -- )
CR . DUP ." is "
IF ( DUP = 0 ) THEN ( ." zero " )
IF ( DUP < 0 ) THEN ( ." negative " )
IF ( 0 < over ) THEN ( ." positive " )
." and "
IF ( = ( 1 AND TUCK ) )
THEN ( ." odd." ELSE ." even." ) ;
KISS TEST
TEST ( 100 - 111 ) \ -11 is negative and odd.