• (up loc)
Returns the loc of the parent of the node at this loc, or nil if at
the top

0 Examples top

Log in to add / edit an example.

See Also top

  • 1
    clojure.zip/down

    Returns the loc of the leftmost child of the node at this loc, or n

  • 1
    clojure.zip/left

    Returns the loc of the left sibling of the node at this loc, or nil

  • 1
    clojure.zip/right

    Returns the loc of the right sibling of the node at this loc, or nil

  • 1
    clojure.zip/next

    Moves to the next loc in the hierarchy, depth-first. When reaching

  • 1
    clojure.zip/seq-zip

    Returns a zipper for nested sequences, given a root sequence

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/zip.clj:123 top

(defn up
  "Returns the loc of the parent of the node at this loc, or nil if at
  the top"
  {:added "1.0"}
  [loc]
    (let [[node {l :l, ppath :ppath, pnodes :pnodes r :r, changed? :changed?, :as path}] loc]
      (when pnodes
        (let [pnode (peek pnodes)]
          (with-meta (if changed?
                       [(make-node loc pnode (concat l (cons node r))) 
                        (and ppath (assoc ppath :changed? true))]
                       [pnode ppath])
                     (meta loc))))))
Vars in clojure.zip/up:
Used in 0 other vars

Comments top

No comments for up. Log in to add a comment.