mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-11 23:07:36 +02:00
Added exact? inexact? exact-integer?
This commit is contained in:
parent
b9e0db08f2
commit
510c5ec2a7
1 changed files with 12 additions and 5 deletions
|
@ -9,7 +9,9 @@
|
||||||
modulo
|
modulo
|
||||||
floor-remainder
|
floor-remainder
|
||||||
even?
|
even?
|
||||||
; exact-integer?
|
exact-integer?
|
||||||
|
exact?
|
||||||
|
inexact?
|
||||||
odd?
|
odd?
|
||||||
call-with-current-continuation
|
call-with-current-continuation
|
||||||
call/cc
|
call/cc
|
||||||
|
@ -177,7 +179,6 @@
|
||||||
; equal?
|
; equal?
|
||||||
; eqv?
|
; eqv?
|
||||||
; exact-integer-sqrt
|
; exact-integer-sqrt
|
||||||
; exact?
|
|
||||||
; expt
|
; expt
|
||||||
; foldl
|
; foldl
|
||||||
; foldr
|
; foldr
|
||||||
|
@ -185,7 +186,6 @@
|
||||||
; get-output-bytevector
|
; get-output-bytevector
|
||||||
; get-output-string
|
; get-output-string
|
||||||
; include
|
; include
|
||||||
; inexact?
|
|
||||||
; input-port-open?
|
; input-port-open?
|
||||||
; input-port?
|
; input-port?
|
||||||
; integer->char
|
; integer->char
|
||||||
|
@ -867,8 +867,15 @@
|
||||||
(define floor-remainder modulo)
|
(define floor-remainder modulo)
|
||||||
(define (odd? num) (= (modulo num 2) 1))
|
(define (odd? num) (= (modulo num 2) 1))
|
||||||
(define (even? num) (= (modulo num 2) 0))
|
(define (even? num) (= (modulo num 2) 0))
|
||||||
; TODO: (define (exact-integer? num)
|
(define (exact-integer? num)
|
||||||
; TODO: (and (exact? num) (integer? num)))
|
(and (exact? num) (integer? num)))
|
||||||
|
(define-c exact?
|
||||||
|
"(void *data, int argc, closure _, object k, object num)"
|
||||||
|
" Cyc_check_num(data, num);
|
||||||
|
if (type_of(num) == integer_tag)
|
||||||
|
return_closcall1(data, k, boolean_t);
|
||||||
|
return_closcall1(data, k, boolean_f); ")
|
||||||
|
(define (inexact? num) (not (exact? num)))
|
||||||
(define (max first . rest) (foldl (lambda (old new) (if (> old new) old new)) first rest))
|
(define (max first . rest) (foldl (lambda (old new) (if (> old new) old new)) first rest))
|
||||||
(define (min first . rest) (foldl (lambda (old new) (if (< old new) old new)) first rest))
|
(define (min first . rest) (foldl (lambda (old new) (if (< old new) old new)) first rest))
|
||||||
))
|
))
|
||||||
|
|
Loading…
Add table
Reference in a new issue