ok 50 25 5 */ 100 - 100 do get-data write-data loop

1 : table-of-horrors ( col row --) \ Print a table of col*row 2 \ numbers for cols and rows 3 \ < 10. 4 2dup 10 < swap 10 < and 5 if 6 2dup * 0 7 do 8 i 2 pick mod 0= 9 if cr 10 then 11 12 i 1+ 10 < 13 if 14 i 1+ . ." " 15 else 16 i 1+ . 17 then 18 loop 19 2drop 20 else ."col and row must each be less than 10!" cr 21 then ;

a) dup ( n1 n2 n3 -- n2 n1 ) ( n1 -- n1 n1 ) ( n1 n2 -- n2 n2 ) ( n1 n2 -- n1 n3 n1 n2 ) ( n1 n2 -- n1 n2 n1 ) b) 2dup ( n1 n2 -- n1 n1 n2 n2 ) ( n1 -- n1 n2 ) ( n1 n2 -- n2 n1 n2 n1 ) ( n1 n2 -- n1 n2 n1 n2 ) ( n1 n2 n1 n2 -- n1 n2 ) c) swap ( n1 n2 n3 -- n2 n3 n1 ) ( n1 n1 -- n1 ) ( n1 n2 -- n2 n1 ) ( n1 n2 -- n1 n2 ) ( n1 n2 -- n1 n2 n1 ) d) rot ( n1 n2 n3 -- n3 n2 n1 ) ( n1 n2 n3 -- n2 n3 n1 ) ( n1 n2 n3 -- n3 n1 n2 ) ( n1 n2 -- n2 n1 ) ( n1 n2 n3 -- n1 n2 n3 ) e) over ( n1 n2 -- n1 n2 n2 ) ( n1 n2 -- n1 n1 n2 ) ( n1 n2 -- n2 n1 n2 ) ( n1 n2 -- n1 n2 n1 n2 ) ( n1 n2 -- n1 n2 n1 )

a) 7 3 / b) 81 10 mod c) 3.33e1 1.11e0 f/ d) 10 2* 2+ 1+ e) 10 3 or f) 10 3 and g) 89 not

b) 81 10 mod

c) 3.33e1 1.11e0 f/

d) 10 2* 2+ 1+

e) 10 3 or

f) 10 3 and

g) 89 not

a) 7 7 < TRUE FALSE b) 76 33 > TRUE FALSE c) 0 3 0= TRUE FALSE d) 3e1 5e1 f<= TRUE FALSE

b) 76 33 > TRUE FALSE

c) 0 3 0= TRUE FALSE

d) 3e1 5e1 f<= TRUE FALSE

: if-then-else-fun ( x y -- ) \ Do stuff based on x and y. 2dup = if over 0> over 0> and if [Code Block A] else [Code Block B] then else 1+ - if [Code Block C] else [Code Block D] then then ;

a) x=3, y=10 A B C D b) x=7, y=7 A B C D c) x=9, y=8 A B C D d) x=0, y=0 A B C D