Интерфейсы

(require '[clojure.string :as str])

(defprotocol Named
  (title [this]))

(defrecord Flower [name] Named (title [this] name))
(defrecord City   [name] Named (title [this] name))
(defrecord Star   [name] Named (title [this] name))

;; one vector holds three unrelated types - the only thing they
;; share is the protocol
(def rows [(->Flower "Rose")
           (->City "Rome")
           (->Star "Sirius")])

(def names (str/join ", " (map title rows)))
;; names is "Rose, Rome, Sirius"
(println "names is" names)