Generic types

;; there is no base class to stand in for: a vector takes anything,
;; and a shared protocol is what makes the values interchangeable
(defprotocol Vehicle
  (test-it [this]))

(defrecord Car [] Vehicle (test-it [_] (println "test Car")))
(defrecord Truck [] Vehicle (test-it [_] (println "test Truck")))

(def items [(->Car) (->Truck)])

(doseq [item items] (test-it item))

;; "is a kind of" can also be stated on plain keywords
(derive ::car ::vehicle)
(println "car is a vehicle:" (isa? ::car ::vehicle))