Skip to content

Commit

Permalink
Add stub for rationalize
Browse files Browse the repository at this point in the history
  • Loading branch information
justinethier committed Jan 9, 2024
1 parent 88fb4b9 commit e499249
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Features

- Enhanced the reader to parse rationals and store them as inexact numbers.
- Add a stub for `(rationalize x y)` to `(scheme base)`.

Bug Fixes

Expand Down
10 changes: 4 additions & 6 deletions scheme/base.sld
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,10 @@
write-u8
binary-port?
textual-port?

rationalize
;;;;
; Possibly missing functions:
;
; u8-ready?
;
; ; No complex or rational numbers at this time
; rationalize
;
; ;; syntax-rules
;;;;
)
Expand Down Expand Up @@ -1483,6 +1478,9 @@
"(void *data, object ptr, object z)"
" return Cyc_is_complex(z); ")
(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 (min first . rest) (foldl (lambda (old new) (if (< old new) old new)) first rest))
; Implementations of gcd and lcm using Euclid's algorithm
Expand Down

0 comments on commit e499249

Please sign in to comment.