mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Allow (list?) to work on circular lists
This commit is contained in:
parent
f23b89a05f
commit
59e895be19
1 changed files with 10 additions and 6 deletions
16
trans.scm
16
trans.scm
|
@ -84,12 +84,16 @@
|
|||
end
|
||||
(func (car lst) (foldr func end (cdr lst)))))
|
||||
(define (not x) (if x #f #t))
|
||||
(define (list? obj)
|
||||
(cond
|
||||
((null? obj) #t)
|
||||
((pair? obj)
|
||||
(list? (cdr obj)))
|
||||
(else #f)))
|
||||
(define (list? o)
|
||||
(define (_list? obj)
|
||||
(cond
|
||||
((null? obj) #t)
|
||||
((pair? obj)
|
||||
(_list? (cdr obj)))
|
||||
(else #f)))
|
||||
(if (Cyc-has-cycle? o)
|
||||
#t
|
||||
(_list? o)))
|
||||
(define (zero? n) (= n 0))
|
||||
(define (positive? n) (> n 0))
|
||||
(define (negative? n) (< n 0))
|
||||
|
|
Loading…
Add table
Reference in a new issue