add some missing function listed in section 6.2. Numbers
This commit is contained in:
parent
5ff2290f68
commit
1b7774eec8
|
@ -63,7 +63,7 @@
|
||||||
| 6.2.3 Implementation restrictions | yes | |
|
| 6.2.3 Implementation restrictions | yes | |
|
||||||
| 6.2.4 Implementation extensions | yes | |
|
| 6.2.4 Implementation extensions | yes | |
|
||||||
| 6.2.5 Syntax of numerical constants | yes | |
|
| 6.2.5 Syntax of numerical constants | yes | |
|
||||||
| 6.2.6 Numerical operations | yes | some functions that return multiple values are not supported for now. Also, picrin does not provide complex library procedures. |
|
| 6.2.6 Numerical operations | yes | `denominator`, `numerator`, and `rationalize` are not supported for now. Also, picrin does not provide complex library procedures. |
|
||||||
| 6.2.7 Numerical input and output | no | |
|
| 6.2.7 Numerical input and output | no | |
|
||||||
| 6.3 Booleans | yes | |
|
| 6.3 Booleans | yes | |
|
||||||
| 6.4 Pairs and lists | yes | |
|
| 6.4 Pairs and lists | yes | |
|
||||||
|
|
|
@ -272,6 +272,20 @@
|
||||||
(car (cddr x))))
|
(car (cddr x))))
|
||||||
bindings))))))
|
bindings))))))
|
||||||
|
|
||||||
|
;;; 6.2. Numbers
|
||||||
|
|
||||||
|
(define (floor/ n m)
|
||||||
|
(values (floor-quotient n m)
|
||||||
|
(floor-remainder n m)))
|
||||||
|
|
||||||
|
(define (truncate/ n m)
|
||||||
|
(values (truncate-quotient n m)
|
||||||
|
(truncate-remainder n m)))
|
||||||
|
|
||||||
|
(define (exact-integer-sqrt k)
|
||||||
|
(let ((n (exact (sqrt k))))
|
||||||
|
(values n (- k (square n)))))
|
||||||
|
|
||||||
(define (boolean=? . objs)
|
(define (boolean=? . objs)
|
||||||
(define (every pred list)
|
(define (every pred list)
|
||||||
(if (null? list)
|
(if (null? list)
|
||||||
|
|
Loading…
Reference in New Issue