You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple types and aggregate types with the same constructor arguments can be compared with eq? so it's fast, but there are cases that non-eq? types are equivalent, e.g. (</> <integer> <string>) and (</> <string> <integer>). We can test equivalence with (and (subtype? X Y) (subtype? Y X)) but it can be slow.
Adding equivalence test callback to <type-constructor-meta> may help testing equivalence fast.
Internally we can sort the elements of choices (the order shouldn't matter as type), so that we can compare them faster.
The text was updated successfully, but these errors were encountered:
shirok
changed the title
Type equivalence
Faster type equivalence testing
Mar 24, 2024
Sorting types isn't that straightforward. We couldn't comapre pointers of <type> instances, for there can be more than one instances of a type. We need to devise a consistent ordering including aggregate types.
Simple types and aggregate types with the same constructor arguments can be compared with
eq?
so it's fast, but there are cases that non-eq?
types are equivalent, e.g.(</> <integer> <string>)
and(</> <string> <integer>)
. We can test equivalence with(and (subtype? X Y) (subtype? Y X))
but it can be slow.Adding equivalence test callback to
<type-constructor-meta>
may help testing equivalence fast.Internally we can sort the elements of choices (the order shouldn't matter as type), so that we can compare them faster.
The text was updated successfully, but these errors were encountered: