title: In Clojure, when should trees of heterogenous node types be represented using records or vectors?
body: <p>Which is better idiomatic clojure practice for representing a tree made up of different node types:</p>
  
  <p>A. building trees out of several different types of records, that one defines using deftype or defrecord:</p>
  
  <pre><code>(defrecord node_a [left right])
  (defrecord node_b [left right])
  (defrecord leaf [])
  
  (def my-tree (node_a. (node_b. (leaf.) (leaf.)) (leaf.)))
  </code></pre>
  
  <p>B. building trees out of vectors, with keywords designating the types:</p>
  
  <pre><code>(def my-tree [:node-a [:node-b :leaf :leaf] :leaf])
  </code></pre>
  
  <p>Most clojure code that I see seems to favor the usage of the general purpose data structures (vectors, maps, etc.), rather than datatypes or records.  Hiccup, to take one example, represents html very nicely using the vector + keyword approach.</p>
  
  <p>When should we prefer one style over the other?</p>