Liking cljdoc? Tell your friends :D

hara.core.base.shorthand


call->clj

(call-> obj [ff & args])

Indirect call, takes obj and a list containing either a function, a symbol representing the function or the symbol ? and any additional arguments. Used for calling functions that have been stored as symbols.

(call-> 1 '(+ 2 3 4)) => 10

(call-> 1 '(< 2)) => true

(call-> {:a {:b 1}} '((get-in [:a :b]) = 1)) => true

Indirect call, takes `obj` and a list containing either a function,
 a symbol representing the function or the symbol `?` and any additional
 arguments. Used for calling functions that have been stored as symbols.

(call-> 1 '(+ 2 3 4)) => 10

(call-> 1 '(< 2)) => true

(call-> {:a {:b 1}} '((get-in [:a :b]) = 1))
=> true
raw docstring

checkclj

(check obj chk)
(check obj sel chk)

checks

(check 2 2) => true

(check 2 even?) => true

(check 2 '(> 1)) => true

(check {:a {:b 1}} '([:a :b] (= 1))) => true

(check {:a {:b 1}} :a vector?) => false

(check {:a {:b 1}} [:a :b] 1) => true

checks

(check 2 2) => true

(check 2 even?) => true

(check 2 '(> 1)) => true

(check {:a {:b 1}} '([:a :b] (= 1))) => true

(check {:a {:b 1}} :a vector?) => false

(check {:a {:b 1}} [:a :b] 1) => true
raw docstring

check->clj

(check-> obj pchk)

Shorthand ways of checking where m fits prchk

(check-> {:a 1} :a) => true

(check-> {:a 1 :val 1} [:val 1]) => true

(check-> {:a {:b 1}} [[:a :b] odd?]) => true

Shorthand ways of checking where `m` fits `prchk`

(check-> {:a 1} :a) => true

(check-> {:a 1 :val 1} [:val 1]) => true

(check-> {:a {:b 1}} [[:a :b] odd?]) => true
raw docstring

check-allclj

(check-all obj & pairs)

Returns true if obj satisfies all pairs of sel and chk

(check-all {:a {:b 1}} :a #(instance? clojure.lang.IPersistentMap %) [:a :b] 1) => true

Returns `true` if `obj` satisfies all pairs of sel and chk

(check-all {:a {:b 1}}
           :a       #(instance? clojure.lang.IPersistentMap %)
           [:a :b]  1)
=> true
raw docstring

check?->clj

(check?-> obj prchk)
(check?-> obj prchk res)

Tests obj using prchk and returns obj or res if true

(check?-> :3 even?) => nil

(check?-> 3 even?) => nil

(check?-> 2 even?) => true

(check?-> {:id :1} '[:id (= :1)]) => true

Tests obj using prchk and returns `obj` or `res` if true

(check?-> :3 even?) => nil

(check?-> 3 even?) => nil

(check?-> 2 even?) => true

(check?-> {:id :1} '[:id (= :1)]) => true
raw docstring

eq->clj

(eq-> obj1 obj2 sel)

Compare if two vals are equal.

(eq-> {:id 1 :a 1} {:id 1 :a 2} :id) => true

(eq-> {:db {:id 1} :a 1} {:db {:id 1} :a 2} [:db :id]) => true

Compare if two vals are equal.

(eq-> {:id 1 :a 1} {:id 1 :a 2} :id)
=> true

(eq-> {:db {:id 1} :a 1}
      {:db {:id 1} :a 2} [:db :id])
=> true
raw docstring

fn->clj

(fn-> form)

Constructs a function from a form representation.

((fn-> '(+ 10)) 10) => 20

Constructs a function from a form representation.

((fn-> '(+ 10)) 10) => 20
raw docstring

get->clj

(get-> obj sel)

Provides a shorthand way of getting a return value. sel can be a function, a vector, or a value.

(get-> {:a {:b {:c 1}}} :a) => {:b {:c 1}}

(get-> {:a {:b {:c 1}}} [:a :b]) => {:c 1}

Provides a shorthand way of getting a return value.
`sel` can be a function, a vector, or a value.

 (get-> {:a {:b {:c 1}}} :a) => {:b {:c 1}}

 (get-> {:a {:b {:c 1}}} [:a :b]) => {:c 1}
raw docstring

shorthand-fn-exprclj

(shorthand-fn-expr form)

Makes a function expression out of the form

(shorthand-fn-expr '(+ 2)) => '(fn [?] (+ ? 2))

Makes a function expression out of the form

(shorthand-fn-expr '(+ 2))
=> '(fn [?] (+ ? 2))
raw docstring

shorthand-formclj

(shorthand-form sym [ff & more])

Makes an expression using sym

(shorthand-form 'y '(str)) => '(str y)

(shorthand-form 'x '((inc) (- 2) (+ 2))) => '(+ (- (inc x) 2) 2)

Makes an expression using `sym`

(shorthand-form 'y '(str)) => '(str y)

(shorthand-form 'x '((inc) (- 2) (+ 2)))
=> '(+ (- (inc x) 2) 2)
raw docstring

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

× close