insert-left

added
1.0

ns
clojure.zip

type
function

(insert-left loc item)

Inserts the item as the left sibling of the node at this loc,
without moving

                ;;; zip is not default required in clj
(require '[clojure.zip :as zip])

(def root-tree (zip/seq-zip '(:root (:1st-left-child ) (:1st-right-child
))))

;;; get the location , in this case is the root of the tree
(def location (-> root-tree zip/next))


(zip/insert-left location :inserted)

;;; then the :inserted is on the left of the original tree
;;;=>[:root
;;; {:changed? true,
;;;  :l [:inserted],
;;;  :pnodes [(:root (:1st-left-child) (:1st-right-child))],
;;;  :ppath nil,
;;;  :r ((:1st-left-child) (:1st-right-child))}]