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

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

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


(defn- get-bits
  [huffman-tree val]
  (defn get-bits-impl [{:keys [values lhs rhs]} directions]
    (cond
      (= 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 []))

