Try out these examples:
Examples are a work in progress...
Count 1 to 10:
: dup ( x -- x x ) sp@ @ ;
: invert ( x -- !x ) dup nand ;
: negate ( x -- -x ) invert 1 + ;
: - ( x y -- x-y ) negate + ;
: = ( x y -- flag ) - 0= ;
: count-ten 0 begin 1 + dup dup . 32 emit 10 = until ;
count-ten
Count 1 to 10, only ouput 5:
: dup ( x -- x x ) sp@ @ ;
: invert ( x -- !x ) dup nand ;
: negate ( x -- -x ) invert 1 + ;
: - ( x y -- x-y ) negate + ;
: = ( x y -- flag ) - 0= ;
: is5? 5 = if dup . then ;
: count-ten 0 begin 1 + dup dup is5? 10 = until ;
count-ten