[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
building other EQUIV?-like predicates
Good thing! Fills a long standing gap
and whenever I actually needed EQUIV?
no time to implement it reliably (so
ended up with a hack for the specific
There is one thing I was asking myself
saw the SRFI:
In many cases I need an application-specific
equivalence which is not among the predefined
ones. For example, it should deal with
structures the way EQUIV? does, but
compared only up to a certain tolerance
that this results in an actual 'equivalence,'
but it is often needed as a predicate
Another example is the presence of user-defined
record types; equivalence predicates
meaningful for the application can ignore
fields while recursing only on others.
In these situations, I would still end
up implementing a
lot of code similar to the reference
give but with little modifications in
the recursion, or
for the atomic types.
So I asked myself if it would be feasible
a 'toolkit' for defining recursive equivalence
relations. Without having thought thoroughly
this, I think the toolkit can take the
form of a single macro,
In SRFI 67 (compare procedures) there
is a macro
SELECT-COMPARE which makes it a convenient
to define a (partially) recursive comparison
An example is DEFAULT-COMPARE:
For SRFI 67 we did not want to go into
cyclic structures at all,
mainly because the SRFI was already
becoming too complex
for its overall purpose.
So my concrete question/proposal:
Do you think a 'SELECT-EQUIV?' macro
sense which dispatches on the types
of its two arguments
to control recursion, but can handle
cyclic structures by
maintaining a stack of subtasks?