 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;; Catch errors in kv_parse
-;; Metadata for assigning types to db entries
 ;; Hashmap functions https://redis.io/commands#hash
 ;; Set functions https://redis.io/commands#set
 ;; Metadata for naming databases
+;; Do values have to be returned with every command?
 
 ;; LATER TODO
 ;; Add radix tree?

        0
        ks)))

(defn kv-parse
  "Parses and executes a GET, SET, DEL, or EXISTS command
  returns same a calling appropriate kv-* function,
  or (:nocmd db) if the command is not found.

  kv-* functions:
  - kv-assoc
  - kv-dissoc
  - kv-get
  - kv-exists "
  [db string]
  (let [[function & operands] (clojure.string/split string #" ")]
    (case function
        "SET" (apply kv-assoc db operands)
        "GET" (apply kv-get db operands)
        "DEL" (apply kv-dissoc db operands)
        "EXISTS" (apply kv-exists db operands)
        (list :nocmd db))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; TESTING

  (atom {}))

(defn kv-whole-map
  "Returns a hashmap snapshot of the entire database
  {k [type value] ...}"
  [db]
  (into {}
    (map
    #((comp vec list)
      (first %) ; key
      [(first (second %)) ; type
        (deref (second (second %)))]) ; value
    @db)))

(defn kv-value
