[r6rs-discuss] equal? and infinite lists
I'm having trouble understanding the meaning of equal? from the
given definition:
equal? returns #t if and only if the (possibly infinite)
unfolding of its arguments into regular trees are equal
as ordered trees.
I don't understand that sentence. What should the value of
the following two expressions be?
(equal? ;;; two infinite lists of 1s
(inflist 1)
(cons 1 (inflist 1)))
(equal? ;;; two infinite lists of 1s
;;; with different "periods"
(inflist 1)
(inflist 1 1))
assuming:
(define (inflist . x*)
(set-cdr! (last-pair x*) x*)
x*)
(define (last-pair x)
(assert (pair? x))
(let f ([x (cdr x)] [r x])
(if (pair? x) (f (cdr x) x) r)))
Thanks.
Aziz,,,
Received on Thu Sep 27 2007 - 22:40:48 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC