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,,,

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to