Liking cljdoc? Tell your friends :D

hydrox.doc.structure


containersclj

source

containifyclj

(containify v)
(containify v [tag & more])

makes a nested vector object from a sequence of elements (containify [{:type :generic} {:type :paragraph} {:type :chapter} {:type :paragraph} {:type :section} {:type :paragraph} {:type :subsection} {:type :paragraph} {:type :section} {:type :chapter} {:type :section} {:type :appendix}]) => [{:type :article} [{:type :generic} [{:type :paragraph}]] [{:type :chapter} [{:type :paragraph}] [{:type :section} [{:type :paragraph}] [{:type :subsection} [{:type :paragraph}]]] [{:type :section}]] [{:type :chapter} [{:type :section}]] [{:type :appendix}]]

makes a nested vector object from a sequence of elements
(containify [{:type :generic}
             {:type :paragraph}
             {:type :chapter}
             {:type :paragraph}
             {:type :section}
             {:type :paragraph}
             {:type :subsection}
            {:type :paragraph}
             {:type :section}
             {:type :chapter}
             {:type :section}
             {:type :appendix}])
=> [{:type :article}
    [{:type :generic}
     [{:type :paragraph}]]
    [{:type :chapter}
     [{:type :paragraph}]
     [{:type :section}
      [{:type :paragraph}]
      [{:type :subsection}
       [{:type :paragraph}]]]
     [{:type :section}]]
    [{:type :chapter}
     [{:type :section}]]
    [{:type :appendix}]]
sourceraw docstring

hierarchyclj

source

inclusiveclj

(inclusive x y)

determines which sections are contained by the other (inclusive :article :section) => true

(inclusive :chapter :subsection) => true

(inclusive :chapter :chapter) => false

(inclusive :section :chapter) => false

determines which sections are contained by the other
(inclusive :article :section) => true

(inclusive :chapter :subsection) => true

(inclusive :chapter :chapter) => false

(inclusive :section :chapter) => false
sourceraw docstring

mapifyclj

(mapify [head & more])
source

mapify-unitclj

(mapify-unit x)
source

seperateclj

(seperate f v)
(seperate f [ele & more] all current)

groups elements in an array (seperate #(= 1 %) [1 2 2 1 3 4 5]) => [[1 2 2] [1 3 4 5]]

groups elements in an array 
(seperate #(= 1 %) [1 2 2 1 3 4 5])
=> [[1 2 2] [1 3 4 5]]
sourceraw docstring

structureclj

(structure v)

creates a nested map structure of elements and their containers (structure [{:type :generic} {:type :paragraph} {:type :chapter} {:type :paragraph} {:type :section} {:type :paragraph} {:type :subsection} {:type :paragraph} {:type :section} {:type :chapter} {:type :section} {:type :appendix}]) => {:type :article, :elements [{:type :generic, :elements [{:type :paragraph}]} {:type :chapter, :elements [{:type :paragraph} {:type :section, :elements [{:type :paragraph} {:type :subsection, :elements [{:type :paragraph}]}]} {:type :section, :elements []}]} {:type :chapter, :elements [{:type :section, :elements []}]} {:type :appendix, :elements []}]}

creates a nested map structure of elements and their containers
(structure [{:type :generic}
            {:type :paragraph}
            {:type :chapter}
            {:type :paragraph}
            {:type :section}
            {:type :paragraph}
            {:type :subsection}
           {:type :paragraph}
            {:type :section}
            {:type :chapter}
            {:type :section}
            {:type :appendix}])
=> {:type :article,
    :elements [{:type :generic,
                :elements [{:type :paragraph}]}
               {:type :chapter,
                :elements [{:type :paragraph}
                           {:type :section,
                            :elements [{:type :paragraph}
                                       {:type :subsection,
                                        :elements [{:type :paragraph}]}]}
                           {:type :section,
                            :elements []}]}
               {:type :chapter,
                :elements [{:type :section, :elements []}]}
               {:type :appendix, :elements []}]}
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close