User Tools

Site Tools


ch2_3_num_compare

Number comparison operators

Comparison between numbers, return T or NIL. Accept mix of integers and floats. Accept any number of arguments, but for trivial zero or single argument always return T.

=

Tests if all arguments are equal.

>(= 1 1.0 (- 2 1))   ; all are 1
T

/=

Tests if no argument is equal to another.

>(/= 1 2 3 1.0 4)   ; there is 1 twice  
NIL

<

Tests if arguments are ordered from smallest to largest.

>(< 1 2 3 3.0 4)   ; there is 3 twice  
NIL

>

Tests if arguments are ordered from largest to smallest.

>(> 4 3 2)    
T

<=

Tests if arguments are ordered so the next argument is at least the same or larger than previous.

>(<= 1 2 3 3.0 3 4) 
T

>=

Tests if arguments are ordered so the next argument is at most the same or smaller than previous.

>(>= 1 2 3 3.0 3 4) 
NIL
ch2_3_num_compare.txt · Last modified: 2021/04/23 02:03 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki