     (last s)
     ))
 
+
+(extend-protocol FastEmpty
+  #+clj clojure.lang.PersistentVector #+cljs cljs.core/PersistentVector
+  (fast-empty? [v]
+    (= 0 (vec-count v)))
+  #+clj Object #+cljs default
+  (fast-empty? [s]
+    (empty? s))
+  )
+
 (defn walk-until [pred on-match-fn structure]
   (if (pred structure)
     (on-match-fn structure)

(extend-protocol p/Navigator
  PosNavigator
  (select* [this structure next-fn]
    (if-not (empty? structure)
      (next-fn ((.-getter this) structure))))
  (transform* [this structure next-fn]
    (if (empty? structure)
      structure
      ((.-updater this) structure next-fn))))


  (get-first [s])
  (get-last [s]))

(defprotocol FastEmpty
  (fast-empty? [s]))

(defn- update-first-list [l afn]
  (cons (afn (first l)) (rest l)))

(defn- update-last-list [l afn]
  (append (butlast l) (afn (last l))))

#+clj
(defn vec-count [^clojure.lang.PersistentVector v]
  (.count v))

#+cljs
(defn vec-count [v]
  (count v))

(extend-protocol UpdateExtremes
  #+clj clojure.lang.PersistentVector #+cljs cljs.core/PersistentVector
