home *** CD-ROM | disk | FTP | other *** search
-
- \ Interval testing words. Naming convention motivated by the
- \ mathematical intervals (a,b) [a,b] (a,b] and [a,b).
- \ Would better names be (A,B) [A,B] ... ?
- \ Application Note: In VP-Planner these four words were
- \ implemented in machine code and saved approximately 500 bytes,
- \ resulted in increased execution speed and better readability
- \ than when actual tests were coded inline in highlevel Forth.
-
- \ (IN) leaves a true flag if a < x < b
- : (IN) ( x a b -- flag ) ( JWB 28 09 88 )
- \ 2DUP < NOT ABORT" Invalid interval."
- -ROT OVER < -ROT > AND ;
-
- \ [IN] leaves a true flag if a <= x <= b , otherwise false.
- : [IN] ( x a b -- flag ) ( JWB 02 10 85 )
- 1+ SWAP 1- SWAP (IN) ;
-
- \ (IN] leaves a true flag if a < x <= b , otherwise false.
- : (IN] ( x a b -- flag ) ( JWB 02 10 85 )
- 1+ (IN) ;
-
- \ [IN) leaves a true flag if a <= x < b , otherwise false.
- : [IN) ( x a b -- flag ) ( JWB 02 10 85 )
- SWAP 1- SWAP (IN) ;
-
-