add some missing function listed in section 6.2. Numbers

This commit is contained in:
Yuichi Nishiwaki 2013-11-14 17:51:57 +09:00
parent 5ff2290f68
commit 1b7774eec8
2 changed files with 15 additions and 1 deletions

View File

@ -63,7 +63,7 @@
| 6.2.3 Implementation restrictions | yes | |
| 6.2.4 Implementation extensions | 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.3 Booleans | yes | |
| 6.4 Pairs and lists | yes | |

View File

@ -272,6 +272,20 @@
(car (cddr x))))
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 (every pred list)
(if (null? list)