 
 (defn- get-bits
   [huffman-tree val]
-  (defn get-bits-impl [{:keys [values lhs rhs]} dirs]
+  (defn get-bits-impl [{:keys [values lhs rhs]} directions]
     (cond
-      (= 1 (count values)) dirs
-      (-> lhs :values val) (recur lhs (conj dirs 0))
-      (-> rhs :values val) (recur rhs (conj dirs 1))
+      (= 1 (count values)) directions
+      (-> lhs :values val) (recur lhs (conj directions 0))
+      (-> rhs :values val) (recur rhs (conj directions 1))
       ))
   (get-bits-impl huffman-tree []))
 

      (make-node (peek heap) (peek rest))
      )))

(defn- make-tree-impl
  "Build the huffman tree from the priority map"
  [heap]
  (if (< 1 (count heap))


(defn make-tree
  "Build the huffman tree from a list of (value, frequence) pairs"
  [value-frequency-pairs]
  (->>
    value-frequency-pairs
    (into (priority-map) (map make-leaf))
    merge-lowest-recursively
    first))


