          (if-let [match (impl/fast-get lookup name)]
            (match (impl/path-params path-params))))))))
 
-(defn- segment-router-lookup-structs
-  "Returns a 2-item vec of lookup structures.
-
-  The first is a prefix-tree of segments and associated Matches.
-  The second is a map of route names to Matches or PartialMatches."
-  [compiled-routes]
-  (reduce
-    (fn [[pl nl] [p {:keys [name] :as data} result]]
-      (let [{:keys [path-params] :as route} (impl/create [p data result])
-            f #(if-let [path (impl/path-for route %)]
-                 (->Match p data result % path)
-                 (->PartialMatch p data result % path-params))]
-        [(segment/insert pl p (->Match p data result nil nil))
-         (if name (assoc nl name f) nl)]))
-    [nil {}]
-    compiled-routes))
-
 (defn segment-router
   "Creates a special prefix-tree style segment router from resolved routes and optional
   expanded options. See [[router]] for available options"

   :compile (fn [[_ {:keys [handler]}] _] handler)
   :conflicts (partial throw-on-conflicts! path-conflicts-str)})

(defn- linear-router-lookup-structs
  "Returns a 2-item vec of lookup structures.

  The first is a vec of Routes.
  The second is a map of route names to lookup fns."
  [compiled-routes]
  (reduce
    (fn [[pl nl] [p {:keys [name] :as data} result]]
      (let [{:keys [path-params] :as route} (impl/create [p data result])
            f #(if-let [path (impl/path-for route %)]
                 (->Match p data result % path)
                 (->PartialMatch p data result % path-params))]
        [(conj pl route)
         (if name (assoc nl name f) nl)]))
    [[] {}]
    compiled-routes))

(defn linear-router
  "Creates a linear-router from resolved routes and optional
  expanded options. See [[router]] for available options"

   (segment-router compiled-routes {}))
  ([compiled-routes opts]
   (let [names (find-names compiled-routes opts)
         [pl nl] (reduce
                   (fn [[pl nl] [p {:keys [name] :as data} result]]
                     (let [{:keys [path-params] :as route} (impl/create [p data result])
                           f #(if-let [path (impl/path-for route %)]
                                (->Match p data result % path)
                                (->PartialMatch p data result % path-params))]
                       [(segment/insert pl p (->Match p data result nil nil))
                        (if name (assoc nl name f) nl)]))
                   [nil {}]
                   compiled-routes)
         lookup (impl/fast-map nl)
         routes (uncompile-routes compiled-routes)]
     ^{:type ::router}
