integers: (eg. ... -3, -2, -1, 0, 1, 2, 3...)
- (integer? v) → boolean?
Returns #t if v is a number that is an integer, #f otherwise.
(integer? 1)
#t
(integer? 2.3)
#f
(integer? 4.0)
#t
(integer? 4.01)
#f
(integer? "hello")
#f
This function is straight forward. A small thing we should pay attention is that
4 and 4.0 are considered integers, but 4.01 is not .
2.(even? n) → boolean?
(even? 10)
#t
(even? 10.0)
#t
(even? 11)
#f
3.(odd? n) → boolean?
act as opposite as even?
4.(remainder n m) → integer?
The remainder of (n / m), for example,
(remainder 10 3) generates 1, since 10 / 3 = 3 ... 1
(remainder 10 3)
1
(remainder 12.0 3)
0
(remainder 14 3)
2
(remainder +inf.0 3)
remainder: contract violation
expected: integer?
given: +inf.0
argument position: 1st
other arguments...:
3
this error because remainder only takes integers as parameters
5.
The above fours functions are specific functions for integers. Other built-in functions
(such as positive? abs ... ) may reference to number post.
https://www.csubc.com/d/16-number