Add stub for rationalize

This commit is contained in:
Justin Ethier 2024-01-08 18:26:38 -08:00
parent 88fb4b909f
commit e4992492b3
2 changed files with 5 additions and 6 deletions

View file

@ -5,6 +5,7 @@
Features Features
- Enhanced the reader to parse rationals and store them as inexact numbers. - Enhanced the reader to parse rationals and store them as inexact numbers.
- Add a stub for `(rationalize x y)` to `(scheme base)`.
Bug Fixes Bug Fixes

View file

@ -205,15 +205,10 @@
write-u8 write-u8
binary-port? binary-port?
textual-port? textual-port?
rationalize
;;;; ;;;;
; Possibly missing functions: ; Possibly missing functions:
;
; u8-ready? ; u8-ready?
;
; ; No complex or rational numbers at this time
; rationalize
;
; ;; syntax-rules ; ;; syntax-rules
;;;; ;;;;
) )
@ -1483,6 +1478,9 @@
"(void *data, object ptr, object z)" "(void *data, object ptr, object z)"
" return Cyc_is_complex(z); ") " return Cyc_is_complex(z); ")
(define rational? number?) (define rational? number?)
;; Stub, doesn't do much now because rationals are not supported
(define (rationalize x y)
(/ x y))
(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))
; Implementations of gcd and lcm using Euclid's algorithm ; Implementations of gcd and lcm using Euclid's algorithm