mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 13:49:16 +02:00
Issue #501 - odd/even must receive an integer
Raise an error if a decimal number is passed to these primitives.
This commit is contained in:
parent
bde930a18b
commit
cb67aeb0a3
2 changed files with 9 additions and 2 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
|
|
||||||
|
- Raise an error if `odd?` or `even?` is passed a decimal number. Thanks to jpellegrini for the bug report.
|
||||||
- Fix `read-line` to read entire lines that consist of more than 1022 bytes. Previously the function would only return partial data up to this limit. Thanks to Robby Zambito for the bug report.
|
- Fix `read-line` to read entire lines that consist of more than 1022 bytes. Previously the function would only return partial data up to this limit. Thanks to Robby Zambito for the bug report.
|
||||||
- `(include "body.scm")` inside a file `path/to/lib.sld` will look for `path/to/body.scm`, then fallback to the legacy behavior, and look for `$(pwd)/body.scm`.
|
- `(include "body.scm")` inside a file `path/to/lib.sld` will look for `path/to/body.scm`, then fallback to the legacy behavior, and look for `$(pwd)/body.scm`.
|
||||||
- Pass append and prepend directories when compiling dependent libraries of a program. This prevents issues where the directories are not made available to any `include` directives within such libraries.
|
- Pass append and prepend directories when compiling dependent libraries of a program. This prevents issues where the directories are not made available to any `include` directives within such libraries.
|
||||||
|
|
|
@ -1409,8 +1409,14 @@
|
||||||
(if (< b 0)
|
(if (< b 0)
|
||||||
(if (<= res 0) res (+ res b))
|
(if (<= res 0) res (+ res b))
|
||||||
(if (>= res 0) res (+ res b)))))
|
(if (>= res 0) res (+ res b)))))
|
||||||
(define (odd? num) (= (modulo num 2) 1))
|
(define (odd? num)
|
||||||
(define (even? num) (= (modulo num 2) 0))
|
(if (integer? num)
|
||||||
|
(= (modulo num 2) 1)
|
||||||
|
(error "Not an integer" num)))
|
||||||
|
(define (even? num)
|
||||||
|
(if (integer? num)
|
||||||
|
(= (modulo num 2) 0)
|
||||||
|
(error "Not an integer" num)))
|
||||||
(define-c bignum?
|
(define-c bignum?
|
||||||
"(void *data, int argc, closure _, object k, object obj)"
|
"(void *data, int argc, closure _, object k, object obj)"
|
||||||
" return_closcall1(data, k, Cyc_is_bignum(obj)); ")
|
" return_closcall1(data, k, Cyc_is_bignum(obj)); ")
|
||||||
|
|
Loading…
Add table
Reference in a new issue