Page Numbers: Yes X: 310 Y: 10.42" First Page: 1
Margins: Top: 1.0" Bottom: 1.5"
Heading:
3-LISP WORKING GUIDE#2: Comparisons
———————————————————————————————————————————
Issue #2:Arithmetic comparison primitive
Description:3-LISP doesn’t currently provide any easy way of determining the relative magnitudes of numbers.
Status:Unresolved
Last Edited:September 16, 1982 (Jim des Rivières)
———————————————————————————————————————————
A simple fix would be to add a "less than" primitive, LT. Other kernel procedures can be defined in terms of this one. For example,
(define LE (lambda simple [n m] (or (lt n m) (= n m))))
(define GT (lambda simple [n m] (lt m n)))
(define GE (lambda simple [n m] (le m n)))
(define NEGATIVE (lambda simple [n] (lt n 0)))
It is a little unfortunate that we can’t use "<", ">", "<=", and ">=" to go along with "="; however, "<" and ">" are reserved for notating closures and the like.
It would also be feasible to choose NEGATIVE as the primitive and to define LT, LE, etc. in terms of it:
(define LT (lambda simple [n m] (negative (- n m))))