Welcome to W3Courses
 Like Us on Facebook

Equal

Check if two Lists are Equal using Scheme Source Code

The following code checks if two lists are equal

  (define equal(lambda (x y)
      (cond((and(null? x) (null? y)) #t)
            ((and(not (null? x)) (not (null? y))) (equal (cdr x) (cdr y)))
            (else #f))))

Share