For Development HEAD DRAFTSearch (procedure/syntax/module):

Next: , Previous: , Up: Library modules - Utilities   [Contents][Index]

12.84 util.isomorph - Determine isomorphism

Module: util.isomorph

Provides a procedure that determines whether two structures are isomorphic.

Function: isomorphic? obj1 obj2 :optional context

{util.isomorph} 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

{util.isomorph} 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?).


Next: , Previous: , Up: Library modules - Utilities   [Contents][Index]


For Development HEAD DRAFTSearch (procedure/syntax/module):
DRAFT