insert-right

added
1.0

ns
clojure.zip

type
function

(insert-right loc item)

Inserts the item as the right 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-right location :inserted)

;; = > [:root
;; {:changed? true,
;;  :l [],
;;  :pnodes [(:root (:1st-left-child) (:1st-right-child))],
;;  :ppath nil,
;;  :r (:inserted (:1st-left-child) (:1st-right-child))}]