 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defprotocol TreeLocMatcher
-  "This protocol provides a function that returns another
-  function that matches the given implementing type
-  to nodes on the dalap tree.
-
-  NOTE: This is currently only being used on vectors of NodeMatcher and
-  function like types."
+  "Provides `to-tree-loc-matcher`, which converts a selector `spec`
+  into a matcher predicate that matches locations in a dalap input
+  tree. It can match on the type or attributes of the current node or,
+  optionally, also match on the parents of the current
+  node.
+
+  The signature of the generated matcher function is [node, walker],
+  which is the same signature as dalap visitors. Any non-nil /
+  non-false return value is considered a match."
   (to-tree-loc-matcher [spec]))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defn- span [p xs]
+  ((juxt (partial take-while p)
+         (partial drop-while p)) xs))
 
 (defn match-selector
   "Grabs a node from history that matches the given

;;; NOTE: all the dynamically created functions (from `fn`) in this
;;; module are given names to aid in debugging

(defn- span [p xs]
  ((juxt (partial take-while p)
         (partial drop-while p)) xs))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; For Maps it checks if the current node is a key of the
;; given map.
(extend clojure.lang.IPersistentMap NodeTransformer
        ;; for some reason interfaces have to be extended like this
        ;; rather than via extend-protocol
