[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.21 util.isomorph - Determine isomorphism

Module: util.isomorph
Provides a procedure that determines whether two structures are isomorphic.

Function: isomorphic? obj1 obj2 &optional context
Returns #t if obj1 and obj2 are isomorphic.

context is used if you want to call isomorphic? recursively inside object-isomorphic? described below.

(isomorphic? '(a b) '(a b)) => #t

(define x (cons 0 0))
(define y (cons 0 0))
(isomorphic? (cons x x)
             (cons x y))
 => #f
(isomorphic? (cons x x)
             (cons y y))
 => #t

Generic Function: object-isomorphic? obj1 obj2 context
With this method, you can customize how to determine isomorphism of two objects. Basically, you will call isomorphic? recursively for each slots of object you want to traverse; the method should return #t if all of the test succeeds, or return #f otherwise. context is an opaque structure that keeps the traversal context, and you should pass it to isomorphic? as is.

The default method returns #t if obj1 and obj2 are equal (in the sense of equal?).

This document was generated by Ken Dickey on November, 28 2002 using texi2html