Using records in Clojure

February 2016 · 1 minute read

When to use:

Pros

Cons

Example:

(defrecord TreeNode [value left right])

(= (TreeNode. 2 nil nil) {:val 2 :left nil :right nil}) ;; => false



tl;dr Stick to hash-maps until you have a specific requirement to use Records.

comments powered by Disqus