home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / p3_2dc.seq < prev    next >
Text File  |  1990-04-03  |  608b  |  28 lines

  1. \ PROGRAM FOR PROBLEM 3.2
  2. \
  3.  
  4.  
  5. : .SDD           ( -- )
  6.         DEPTH ?DUP IF
  7.                 0 ?DO DEPTH I - 1- PICK
  8.                       DEPTH I - 2- PICK
  9.                       D. 8 EMIT
  10.                       ASCII . EMIT
  11.                 2 +LOOP
  12.                 ELSE ." Empty" THEN ;
  13.  
  14. : .SS           ( -- )
  15.         DEPTH ?DUP IF
  16.                 0 ?DO DEPTH I - 1- PICK
  17.                 .  \ OUTPUT VALUE
  18.                 LOOP
  19.                 ELSE ." Empty" THEN ;
  20.  
  21. : .SD           ( -- )
  22.         DEPTH 2 MOD IF
  23.                 .SS
  24.         ELSE
  25.                 .SDD
  26.         THEN ;
  27.  
  28.