New version of (list?)

This commit is contained in:
Justin Ethier 2018-12-12 13:43:47 -05:00
parent 9eddbb812b
commit 2d9ba5a9e3

View file

@ -223,6 +223,7 @@
negative? negative?
positive? positive?
zero? zero?
list?
not not
string>=? string>=?
string>? string>?
@ -706,16 +707,11 @@
(define (newline . port) (define (newline . port)
(apply write-char (cons #\newline port))) (apply write-char (cons #\newline port)))
(define (not x) (if x #f #t)) (define (not x) (if x #f #t))
(define (list? o) (define-c list?
(define (_list? obj) "(void *data, int argc, closure _, object k, object o)"
(cond " return_closcall1(data, k, Cyc_is_list(o));"
((null? obj) #t) "(void *data, object ptr, object o)"
((pair? obj) " return Cyc_is_list(o);")
(_list? (cdr obj)))
(else #f)))
(if (Cyc-has-cycle? o)
#t
(_list? o)))
(define (zero? n) (= n 0)) (define (zero? n) (= n 0))
(define (positive? n) (> n 0)) (define (positive? n) (> n 0))
(define (negative? n) (< n 0)) (define (negative? n) (< n 0))