(derive tag parent) (derive h tag parent)
Establishes a parent/child relationship between parent and tag. Parent must be a namespace-qualified symbol or keyword and child can be either a namespace-qualified symbol or keyword or a class. h must be a hierarchy obtained from make-hierarchy, if not supplied defaults to, and modifies, the global hierarchy.
;; derive let you build a hierarchy but parents/ancestors/descendants and isa? let you query the hierarchy
(derive ::rect ::shape)
(derive ::square ::rect)
user=> (derive ::Cat ::Feline)
nil
user=> (derive ::Lion ::Feline)
nil
user=> (isa? ::Lion ::Feline)
true
user=> (isa? ::Tuna ::Feline)
false
(derive java.util.Map ::collection)
(derive java.util.Collection ::collection)
(isa? java.util.HashMap ::collection)
-> true