Welcome! Please see the About page for a little more info on how this works.

0 votes
in Records and Types by

I'm trying to understand how to use the isa? function, but I don't yet understand exactly what the valid arguments of this function are, but somehow they are type-designators, or type-names, or whatever the clojure terminology for that is.
My question is: given two valid type-designators for isa? how do I find out whether the two designated types intersect. I.e., is it possible to have an object which is of both types?

The blog post of Ambrose sort of hints at this enough to make me even more curious.
As the blog post specifies, there is no equivalent of the Common Lisp subtypep function in clojure. But in Common Lisp I can ask whether type A is a subtype of B, and I can express intersection types as (and A B). Thus I can ask intersection questions by asking whether the intersection is a subtype of the empty type. (subtypep (and A B) nil)

What is the closest to that that exists in clojure?

1 Answer

0 votes
by

https://clojure.org/reference/multimethods is a pretty good overview of creating arbitrary keyword hierarchies and using isa? for that.

Not sure that I understand the type questions or Lisp context enough to answer the rest.

...