function | since v0.0-927 | ![]() | Edit |
(prev loc)
Moves to the previous loc in the hierarchy, depth-first. If already at the root, returns nil.
(defn prev
[loc]
(if-let [lloc (left loc)]
(loop [loc lloc]
(if-let [child (and (branch? loc) (down loc))]
(recur (rightmost child))
loc))
(up loc)))