 (defn- scan-namespace-for-doc
   "Build a map of functions in namespace <-> url prefixes."
   [namespace]
-  (remove nil?
-          (map #(get-function-meta namespace %) (ns-paths namespace))))
+  (->> namespace
+       ns-paths
+       (map #(get-function-meta namespace %))
+       (remove nil?)))
 
 (defn build-map-arg-resolver
   "Build an argument resolver which takes a list of keys and constant values and when required argument

      (get (:route-params request) api-kw)
      (get (:route-params request) arg-kw)
      (get (:params request) api-kw)
      (get (:params request) arg-kw)
      )))

(defn- ns-function
  "Return the var for the given namespance and function keyword."

  (get request arg))

(defn arg-resolver-middleware
  "Middleware which adds provided argument resolvers to [:rook :default-arg-resolvers] collection."
  [handler & arg-resolvers]
  (fn [request]
    (handler (assoc request
               :rook (merge (:rook request)
                            {:default-arg-resolvers (concat (:default-arg-resolvers (:rook request)) arg-resolvers)})))))

(defn get-available-paths
  "Scan namespace for available routes - only those that have available function are returned.

  Routes are sorted by the line number from metadata - which can be troubling if you have the same namespace in many files.

  But then, unless your name is Rich, you're in trouble already... "
  [namespace]
  (->> (ns-paths namespace)
       (map (fn [[[request-method path] function-key]]
              (when-let [fun (ns-function namespace function-key)]
                [[request-method path] fun])))
       (remove nil?)
       (sort-by #(or (-> % second meta :line) 0)))) ;sadly, the namespace stores interned values

(defn- get-compiled-paths
  [namespace]
