Back
children (clj)
(source)function
(children loc)
Returns a seq of the children of node at loc, which must be a branch
Examples
clojure
(ns clojure.test-clojure.clojure-zip
(:use clojure.test)
(:require [clojure.zip :as zip]))
; zipper
;
; seq-zip
; vector-zip
; xml-zip
;
; node
; branch?
; children
; make-node
; path
; lefts
; rights
; down
; up
; root
; right
; rightmost
; left
; leftmost
;
; insert-left
; insert-right
; replace
; edit
; insert-child
; append-child
; next
; prev
; end?
; remove
babashka/babashka
(ns babashka.impl.clojure.zip
{:no-doc true}
(:require [clojure.zip :as zip]
[sci.core :as sci :refer [copy-var]]))
(def zip-namespace
{'zipper (copy-var zip/zipper zip-ns)
'seq-zip (copy-var zip/seq-zip zip-ns)
'vector-zip (copy-var zip/vector-zip zip-ns)
'xml-zip (copy-var zip/xml-zip zip-ns)
'node (copy-var zip/node zip-ns)
'branch? (copy-var zip/branch? zip-ns)
'children (copy-var zip/children zip-ns)
'make-node (copy-var zip/make-node zip-ns)
'path (copy-var zip/path zip-ns)
'lefts (copy-var zip/lefts zip-ns)
'rights (copy-var zip/rights zip-ns)
'down (copy-var zip/down zip-ns)
'up (copy-var zip/up zip-ns)
'root (copy-var zip/root zip-ns)
'right (copy-var zip/right zip-ns)
'rightmost (copy-var zip/rightmost zip-ns)
'left (copy-var zip/left zip-ns)
'leftmost (copy-var zip/leftmost zip-ns)
'insert-left (copy-var zip/insert-left zip-ns)
'insert-right (copy-var zip/insert-right zip-ns)
'replace (copy-var zip/replace zip-ns)
'edit (copy-var zip/edit zip-ns)
'insert-child (copy-var zip/insert-child zip-ns)
'append-child (copy-var zip/append-child zip-ns)
'next (copy-var zip/next zip-ns)
'prev (copy-var zip/prev zip-ns)
'end? (copy-var zip/end? zip-ns)
'remove (copy-var zip/remove zip-ns)})
videlalvaro/clochure
[ns clojure.test-clojure.clojure-zip
[:use clojure.test]
[:require (clojure.zip :as zip)]]
; zipper
;
; seq-zip
; vector-zip
; xml-zip
;
; node
; branch?
; children
; make-node
; path
; lefts
; rights
; down
; up
; root
; right
; rightmost
; left
; leftmost
;
; insert-left
; insert-right
; replace
; edit
; insert-child
; append-child
; next
; prev
; end?
; remove
eihli/clj-tightly-packed-trie
(ns trie-test
(:require [clojure.test :refer [deftest is testing use-fixtures] :as t]
[com.owoga.trie :as trie]
[clojure.zip :as zip]
[clojure.main :as main]))
(deftest children-at-depth-tests
(let [initialized-trie (->> (trie/make-trie '(1) 1 '(1 2 3) 123 '(1 2 1) 121 '(1 2 2) 122 '(1 3 1) 131
'(1 2 3 4) 1234
'(1 2 3 4 5 6) 123456))]
(testing "children at depth"
(is (= '([(1) 1])
(trie/children-at-depth initialized-trie 0)))
(is (= '([(1 2 3 4 5 6) 123456]
[(1 2 3 4) 1234])
(trie/children-at-depth initialized-trie 4 6)))
(is (= nil (trie/children-at-depth initialized-trie -1)))
(is (= nil (trie/children-at-depth initialized-trie 5 4))))))
davidsantiago/tinsel
(ns tinsel.test.zip
(:use tinsel.zip
clojure.test)
(:require [clojure.zip :as zip]
[tinsel.utils :as utils]
[hiccup.core :as hiccup]))
(deftest test-basic-fns-unnormalized
(is (= [:body [:ul [:li] [:li]]]
(-> unnormalized-small-zip zip/down zip/down zip/root)))
(is (= [:ul [:li] [:li]]
(-> unnormalized-small-zip zip/down zip/node)))
(is (= '([:li] [:li])
(-> unnormalized-small-zip zip/down zip/children)))
(is (= [:li]
(-> unnormalized-small-zip zip/next zip/next zip/next zip/node))))
(deftest test-basic-fns-normalized
(is (= ["body" {:id nil :class nil}
["ul" {:id nil :class nil}
["li" {:id nil :class nil}] ["li" {:id nil :class nil}]]]
(-> normalized-small-zip zip/down zip/down zip/root)))
(is (= ["ul" {:id nil :class nil}
["li" {:id nil :class nil}] ["li" {:id nil :class nil}]]
(-> normalized-small-zip zip/down zip/node)))
(is (= '(["li" {:id nil :class nil}] ["li" {:id nil :class nil}])
(-> normalized-small-zip zip/down zip/children)))
(is (= ["li" {:id nil :class nil}]
(-> normalized-small-zip zip/next zip/next zip/next zip/node))))