home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / p3_10dc.seq < prev    next >
Text File  |  1990-04-05  |  709b  |  24 lines

  1. \ Answer for problem 3.10 by Dickson Cheng  04/04/90 21:30:34.56
  2.  
  3. \ If the interval testing words are used with invalid internals
  4. \ the flag will always be false.
  5.  
  6.  
  7. \ (IN) leaves a true flag if a < x < b , otherwise false.
  8. : (IN)          ( x a b -- flag )
  9.         OVER 1 PICK > IF SWAP THEN
  10.         -ROT OVER < -ROT > AND ;
  11.  
  12. \ [IN] leaves a true flag if a <= x <= b , otherwise false.
  13. : [IN]          ( x a b -- flag )
  14.         1+ SWAP 1- SWAP (IN) ;
  15.  
  16. \ (IN] leaves a true flag if a < x <= b , otherwise false.
  17. : (IN]          ( x a b -- flag )
  18.         1+ (IN) ;
  19.  
  20. \ [IN) leaves a true flag if a <= x < b , otherwise false.
  21. : [IN)          ( x a b -- flag )
  22.         SWAP 1- SWAP (IN) ;
  23.  
  24.