 (defn regex? 
   [r]
   (instance? java.util.regex.Pattern r))
+
+(defn- get-absolute-path
+  [path]
+  (reduce 
+    #(case %2
+       :.. (pop %1) 
+       :. %1
+       (conj %1 %2))
+    @CURRENT_DIR path))
 
 (defn- resolve-path
   [parts]

        (if (empty? ks)
          nil
          (PathList. (map #(conj base-path %) ks)))) 
      (reduce #(case %2
                 :.. (pop %1) 
                 :. %1
                 (conj %1 %2))
              @CURRENT_DIR p))))

(defn ls 
  "List keys in current directory of filesystem, or given path."
  [& key-path]
  (let [p (resolve-path key-path)
        values (if (pathlist? p)
                 (sort (.paths p)) 
                 (map #(conj p %) (sort (keys (get-in @FS_ROOT p)))))]
  (->>
    values
    (map 
      #(let [v (get-in @FS_ROOT %)
             k (last %)] 
         (if (is-dir? v)
         (str "D " k) 
         (str "- " k))))
    (str/join "\n"))))

(defn pwd 
  "Print current working directory."

(defn rmdir 
  "Removes a directory"
  [key-name]
  (let [path (resolve-single-path [key-name])
        v (get-in @FS_ROOT path)]
    (cond 
      (nil? v) 
