(!! ova pchk val)sets the value of selected data cells in the ova
(-> (range 5) (ova) (!! 1 0) (<<)) => [0 0 2 3 4]
(-> (range 5) (ova) (!! #{1 2} 0) (<<)) => [0 0 0 3 4]
(-> (range 5) (ova) (!! even? 0) (<<)) => [0 1 0 3 0]
sets the value of selected data cells in the ova
(-> (range 5)
    (ova)
    (!! 1 0)
    (<<))
=> [0 0 2 3 4]
(-> (range 5)
    (ova)
    (!! #{1 2} 0)
    (<<))
=> [0 0 0 3 4]
(-> (range 5)
    (ova)
    (!! even? 0)
    (<<))
=> [0 1 0 3 0](!> ova pchk & forms)applies a set of transformations to a selector on the ova
(<< (!> (ova [{:id :1}]) 0 (assoc-in [:a :b] 1) (update-in [:a :b] inc) (assoc :c 3))) => [{:id :1 :c 3 :a {:b 2}}]
applies a set of transformations to a selector on the ova
(<< (!> (ova [{:id :1}])
        0
        (assoc-in [:a :b] 1)
        (update-in [:a :b] inc)
        (assoc :c 3)))
=> [{:id :1 :c 3 :a {:b 2}}](<< & forms)outputs outputs the entire output of an ova
(-> (ova [1 2 3 4 5]) (append! 6 7 8 9) (<<)) => [1 2 3 4 5 6 7 8 9]
;; can also use persistent!
(-> (ova [1 2 3 4 5])
(persistent!))
=> [1 2 3 4 5]
outputs outputs the entire output of an ova
(-> (ova [1 2 3 4 5])
    (append! 6 7 8 9)
    (<<))
=> [1 2 3 4 5 6 7 8 9]
;; can also use `persistent!`
(-> (ova [1 2 3 4 5])
    (persistent!))
=> [1 2 3 4 5](append! ova & es)like conj! but appends multiple array elements to the ova
(-> (ova [{:id :1 :val 1}]) (append! {:id :2 :val 1} {:id :3 :val 2}) (<<)) => [{:id :1 :val 1} {:id :2 :val 1} {:id :3 :val 2}]
like `conj!` but appends multiple array elements to the ova
(-> (ova [{:id :1 :val 1}])
    (append! {:id :2 :val 1}
             {:id :3 :val 2})
    (<<))
=> [{:id :1 :val 1}
    {:id :2 :val 1}
    {:id :3 :val 2}](clone old)creates an exact copy of the ova, including its watches
(def o (ova (range 10))) (watch/set o {:a (fn [_ _ _ _ _])})
(def other (clone o))
(<< other) => (<< o) (watch/list other) => (just {:a fn?})
creates an exact copy of the ova, including its watches
(def o (ova (range 10)))
(watch/set o {:a (fn [_ _ _ _ _])})
(def other (clone o))
(<< other) => (<< o)
(watch/list other) => (just {:a fn?})(concat! ova es & more)works like concat, allows both array and ova inputs
(<< (concat! (ova [{:id :1 :val 1} {:id :2 :val 1}]) (ova [{:id :3 :val 2}]) [{:id :4 :val 2}])) => [{:val 1, :id :1} {:val 1, :id :2} {:val 2, :id :3} {:val 2, :id :4}]
works like `concat`, allows both array and ova inputs
(<< (concat! (ova [{:id :1 :val 1}
                   {:id :2 :val 1}])
             (ova [{:id :3 :val 2}])
             [{:id :4 :val 2}]))
=> [{:val 1, :id :1}
    {:val 1, :id :2}
    {:val 2, :id :3}
    {:val 2, :id :4}](delete-indices ova idx)helper function for remove! to change state
helper function for `remove!` to change state
(empty! ova)empties an existing ova
(-> (ova [1 2 3 4 5]) (empty!) (<<)) => []
empties an existing ova
(-> (ova [1 2 3 4 5])
    (empty!)
    (<<))
=> [](filter! ova pchk)keep only elements that matches the selector
(-> (ova [0 1 2 3 4 5 6 7 8 9]) (filter! #{'(< 3) '(> 6)}) (<<)) => [0 1 2 7 8 9]
keep only elements that matches the selector
(-> (ova [0 1 2 3 4 5 6 7 8 9])
    (filter! #{'(< 3) '(> 6)})
    (<<))
=> [0 1 2 7 8 9](get-filtered ova k sel nv)gets the first element in the ova that matches the selector:
(def o (ova [{:id :1 :val 1} {:id :2 :val 1}]))
(get-filtered o :1 nil nil) => {:val 1, :id :1}
(get-filtered o :2 nil nil) => {:val 1, :id :2}
(get-filtered o :3 nil :not-found) => :not-found
gets the first element in the ova that matches the selector:
(def o (ova [{:id :1 :val 1} {:id :2 :val 1}]))
(get-filtered o :1 nil nil)
=> {:val 1, :id :1}
(get-filtered o :2 nil nil)
=> {:val 1, :id :2}
(get-filtered o :3 nil :not-found)
=> :not-found(has? ova)(has? ova pchk)checks that the ova contains elements matching a selector
(def o (ova [{:id :1 :val 1} {:id :2 :val 1} {:id :3 :val 2} {:id :4 :val 2}]))
(has? o) => true
(has? o 0) => true
(has? o -1) => false
(has? o [:id '((name) (bigint) (odd?))]) => true
checks that the ova contains elements matching a selector
(def o (ova [{:id :1 :val 1} {:id :2 :val 1}
             {:id :3 :val 2} {:id :4 :val 2}]))
(has? o)
=> true
(has? o 0)
=> true
(has? o -1)
=> false
(has? o [:id '((name)
               (bigint)
               (odd?))])
=> true(indices ova)(indices ova pchk)instead of data, outputs the matching indices
(def o (ova [{:id :1 :val 1} {:id :2 :val 1} {:id :3 :val 2} {:id :4 :val 2}]))
(indices o) => [0 1 2 3]
(indices o 0) => [0]
(indices o [:val 1]) => [0 1]
(indices o [:val even?]) => [2 3]
(indices o [:val even? '(:id (name) (bigint)) odd?]) => [2]
(indices o #{4}) => []
(indices o [:id :1]) => [0]
instead of data, outputs the matching indices
(def o (ova [{:id :1 :val 1} {:id :2 :val 1}
             {:id :3 :val 2} {:id :4 :val 2}]))
(indices o)
=> [0 1 2 3]
(indices o 0)
=> [0]
(indices o [:val 1])
=> [0 1]
(indices o [:val even?])
=> [2 3]
(indices o [:val even?
            '(:id (name) (bigint)) odd?])
=> [2]
(indices o #{4})
=> []
(indices o [:id :1])
=> [0](init! ova)(init! ova coll)sets elements within an ova
(def o (ova [])) (->> (init! o [{:id :1 :val 1} {:id :2 :val 1}]) (dosync) (<<)) => [{:val 1, :id :1} {:val 1, :id :2}]
sets elements within an ova
(def o (ova []))
(->> (init! o [{:id :1 :val 1} {:id :2 :val 1}])
     (dosync)
     (<<))
=> [{:val 1, :id :1} {:val 1, :id :2}](insert! ova val & [i])inserts data at either the end of the ova or when given an index
(-> (ova (range 5)) (insert! 6) (<<)) => [0 1 2 3 4 6]
(-> (ova (range 5)) (insert! 6) (insert! 5 5) (<<)) => [0 1 2 3 4 5 6]
inserts data at either the end of the ova or when given an index
(-> (ova (range 5))
    (insert! 6)
    (<<))
=> [0 1 2 3 4 6]
(-> (ova (range 5))
    (insert! 6)
    (insert! 5 5)
    (<<))
=> [0 1 2 3 4 5 6](insert-fn v val & [i])helper function for insert!
helper function for `insert!`
(map! ova f & args)applies a function on the ova with relevent arguments
(-> (ova [{:id :1} {:id :2}]) (map! assoc :val 1) (<<)) => [{:val 1, :id :1} {:val 1, :id :2}]
applies a function on the ova with relevent arguments
(-> (ova [{:id :1} {:id :2}])
    (map! assoc :val 1)
    (<<))
=> [{:val 1, :id :1}
    {:val 1, :id :2}](map-indexed! ova f)applies a function that taking the data index as well as the data to all elements of the ova
(-> (ova [{:id :1} {:id :2}]) (map-indexed! (fn [i m] (assoc m :val i))) (<<)) => [{:val 0, :id :1} {:val 1, :id :2}]
applies a function that taking the data index as well as the data
to all elements of the ova
(-> (ova [{:id :1} {:id :2}])
    (map-indexed! (fn [i m]
                    (assoc m :val i)))
    (<<))
=> [{:val 0, :id :1}
    {:val 1, :id :2}](ova)(ova coll)constructs an instance of an ova
(ova []) ;=> #ova []
(ova [1 2 3]) ;=> #ova [1 2 3]
(<< (ova [{:id :1} {:id :2}])) => [{:id :1} {:id :2}]
constructs an instance of an ova
(ova []) ;=> #ova []
(ova [1 2 3]) ;=>  #ova [1 2 3]
(<< (ova [{:id :1} {:id :2}]))
=> [{:id :1} {:id :2}](ova? x)checks if an object is an ova instance
(ova? (ova [1 2 3])) => true
checks if an object is an ova instance (ova? (ova [1 2 3])) => true
(remove! ova pchk)removes data from the ova that matches a selector
(-> (ova (range 10)) (remove! odd?) (<<)) => [0 2 4 6 8]
(-> (ova (range 10)) (remove! #{'(< 3) '(> 6)}) (<<)) => [3 4 5 6]
removes data from the ova that matches a selector
(-> (ova (range 10))
    (remove! odd?)
    (<<))
=> [0 2 4 6 8]
(-> (ova (range 10))
    (remove! #{'(< 3) '(> 6)})
    (<<))
=> [3 4 5 6](reverse! ova)reverses the order of elements in the ova
(-> (ova (range 5)) (reverse!) (<<)) => [4 3 2 1 0]
reverses the order of elements in the ova
(-> (ova (range 5))
    (reverse!)
    (<<))
=> [4 3 2 1 0](select ova)(select ova pchk)grabs the selected ova entries as a set of values
(def o (ova [{:id :1 :val 1} {:id :2 :val 1} {:id :3 :val 2} {:id :4 :val 2}]))
(select o) ;; no filters => #{{:id :1, :val 1} {:id :2, :val 1} {:id :3, :val 2} {:id :4, :val 2}}
(select o 0) ;; by index => #{{:id :1 :val 1}}
(select o #{1 2}) ;; by indices => #{{:id :2 :val 1} {:id :3 :val 2}}
(select o #(even? (:val %))) ;; by function => #{{:id :3 :val 2} {:id :4 :val 2}}
(select o [:val 1]) ;; by shorthand value => #{{:id :1 :val 1} {:id :2 :val 1}}
(select o [:val even?]) ;; by shorthand function => #{{:id :3 :val 2} {:id :4 :val 2}}
(select o #{[:id :1] ;; or selection [:val 2]}) => #{{:id :1 :val 1} {:id :3 :val 2} {:id :4 :val 2}}
(select o [:id '((name) ;; by shorthand expression (bigint) (odd?))]) => #{{:id :1 :val 1} {:id :3 :val 2}}
grabs the selected ova entries as a set of values
(def o (ova [{:id :1 :val 1} {:id :2 :val 1}
             {:id :3 :val 2} {:id :4 :val 2}]))
(select o)              ;; no filters
=> #{{:id :1, :val 1}
     {:id :2, :val 1}
     {:id :3, :val 2}
     {:id :4, :val 2}}
(select o 0)            ;; by index
=> #{{:id :1 :val 1}}
(select o #{1 2})       ;; by indices
=> #{{:id :2 :val 1}
     {:id :3 :val 2}}
(select o #(even? (:val %))) ;; by function
=> #{{:id :3 :val 2}
     {:id :4 :val 2}}
(select o [:val 1])        ;; by shorthand value
=> #{{:id :1 :val 1}
     {:id :2 :val 1}}
(select o [:val even?])    ;; by shorthand function
=> #{{:id :3 :val 2}
     {:id :4 :val 2}}
(select o #{[:id :1]       ;; or selection
            [:val 2]})
=> #{{:id :1 :val 1}
     {:id :3 :val 2}
     {:id :4 :val 2}}
(select o [:id '((name)    ;; by shorthand expression
                 (bigint)
                 (odd?))])
=> #{{:id :1 :val 1}
     {:id :3 :val 2}}(selectv ova)(selectv ova pchk)grabs the selected ova entries as vector
(def o (ova [{:id :1 :val 1} {:id :2 :val 1} {:id :3 :val 2} {:id :4 :val 2}]))
(selectv o) ;; no filters => [{:id :1, :val 1} {:id :2, :val 1} {:id :3, :val 2} {:id :4, :val 2}]
(selectv o 0) ;; by index => [{:id :1 :val 1}]
(selectv o [:val even?]) ;; by shorthand function => [{:id :3 :val 2} {:id :4 :val 2}]
(selectv o [:id '((name) ;; by shorthand expression (bigint) (odd?))]) => [{:id :1 :val 1} {:id :3 :val 2}]
grabs the selected ova entries as vector
(def o (ova [{:id :1 :val 1} {:id :2 :val 1}
             {:id :3 :val 2} {:id :4 :val 2}]))
(selectv o)              ;; no filters
=> [{:id :1, :val 1}
    {:id :2, :val 1}
    {:id :3, :val 2}
    {:id :4, :val 2}]
(selectv o 0)            ;; by index
=> [{:id :1 :val 1}]
(selectv o [:val even?])    ;; by shorthand function
=> [{:id :3 :val 2}
    {:id :4 :val 2}]
(selectv o [:id '((name)    ;; by shorthand expression
                  (bigint)
                  (odd?))])
=> [{:id :1 :val 1}
    {:id :3 :val 2}](smap! ova pchk f & args)applies a function to only selected elements of the array
(-> (ova [{:id :1 :val 1} {:id :2 :val 1} {:id :3 :val 2} {:id :4 :val 2}]) (smap! [:val 1] update-in [:val] #(+ % 100)) (<<)) => [{:id :1, :val 101} {:id :2, :val 101} {:id :3, :val 2} {:id :4, :val 2}]
applies a function to only selected elements of the array
(-> (ova [{:id :1 :val 1}
          {:id :2 :val 1}
          {:id :3 :val 2}
          {:id :4 :val 2}])
    (smap! [:val 1]
           update-in [:val] #(+ % 100))
    (<<))
=> [{:id :1, :val 101}
   {:id :2, :val 101}
    {:id :3, :val 2}
    {:id :4, :val 2}](smap-indexed! ova pchk f)applies a function that taking the data index as well as the data to selected elements of the ova
(-> (ova [{:id :1 :val 1} {:id :2 :val 1} {:id :3 :val 2} {:id :4 :val 2}]) (smap-indexed! [:val 1] (fn [i m] (update-in m [:val] #(+ i 100 %)))) (<<)) => [{:id :1, :val 101} {:id :2, :val 102} {:id :3, :val 2} {:id :4, :val 2}]
applies a function that taking the data index as well as the data
to selected elements of the ova
(-> (ova [{:id :1 :val 1}
          {:id :2 :val 1}
          {:id :3 :val 2}
          {:id :4 :val 2}])
    (smap-indexed! [:val 1]
                   (fn [i m]
                     (update-in m [:val] #(+ i 100 %))))
   (<<))
=> [{:id :1, :val 101}
    {:id :2, :val 102}
    {:id :3, :val 2}
    {:id :4, :val 2}](sort! ova)(sort! ova comp)(sort! ova sel comp)sorts all data in the ova using a comparator function
(-> (ova [2 1 3 4 0]) (sort! >) (<<)) => [4 3 2 1 0]
(-> (ova [2 1 3 4 0]) (sort! <) (<<)) => [0 1 2 3 4]
sorts all data in the ova using a comparator function
(-> (ova [2 1 3 4 0])
    (sort! >)
    (<<))
=> [4 3 2 1 0]
(-> (ova [2 1 3 4 0])
    (sort! <)
    (<<))
=> [0 1 2 3 4](split ova pchk)splits an ova into two based on a predicate
(def o (ova (range 10))) (def sp (dosync (split o #{'(< 3) '(> 6)})))
(persistent! (sp true)) => [0 1 2 7 8 9] (persistent! (sp false)) => [3 4 5 6]
splits an ova into two based on a predicate
(def o (ova (range 10)))
(def sp (dosync (split o #{'(< 3) '(> 6)})))
(persistent! (sp true))  => [0 1 2 7 8 9]
(persistent! (sp false)) => [3 4 5 6]cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |