Liking cljdoc? Tell your friends :D

std.contract.binding


bindclj

(bind contract)

binds the contract to its var

(defn -minus- ([x y] (- x y)))

(do (bind (contract #'-minus- [])) (bound? #'-minus-)) => true

binds the contract to its var

(defn -minus-
  ([x y]
   (- x y)))

(do (bind (contract #'-minus- []))
    (bound? #'-minus-))
=> true
raw docstring

bound?clj

(bound? obj)

checks if contract is bound to var

(bound? #'-add-) => false

(bound? #'-contract-) => false

(bound? -contract-) => false

checks if contract is bound to var

(bound? #'-add-)
=> false

(bound? #'-contract-)
=> false

(bound? -contract-)
=> false
raw docstring

contractclj

(contract var inputs)
(contract var inputs output)

defines a contract given var and arguments

defines a contract given var and arguments
raw docstring

contract-infoclj

(contract-info {:keys [var] :as contract})

returns the contract info

(-> (contract #'-add- [] nil) (contract-info)) => map?

returns the contract info

(-> (contract #'-add- [] nil)
    (contract-info))
=> map?
raw docstring

contract-invokeclj

(contract-invoke contract & args)

invokes the contract

(-> (contract #'-add- [] nil) (contract-invoke 1 2)) => 3

invokes the contract

(-> (contract #'-add- [] nil)
    (contract-invoke 1 2))
=> 3
raw docstring

contract-var?clj

(contract-var? var)

checks if var contains a contract

(contract-var? #'-add-) => false

(contract-var? #'-contract-) => true

checks if var contains a contract

(contract-var? #'-add-)
=> false

(contract-var? #'-contract-)
=> true
raw docstring

contract?clj

(contract? obj)

checks if object is a contract

checks if object is a contract
raw docstring

defcontractcljmacro

(defcontract sym & body)

defines a contract

(type/defspec <int> integer?)

(defcontract -add- :inputs [<int> <int>])

(-add- 0.5 0.5) => (throws)

defines a contract

(type/defspec <int> integer?)

(defcontract -add-
  :inputs [<int> <int>])

(-add- 0.5 0.5)
=> (throws)
raw docstring

parse-argclj

(parse-arg obj)

parses an input/output arg

(type/defspec <number> number?)

(parse-arg {<number> :strict})

parses an input/output arg

(type/defspec <number> number?)

(parse-arg {<number> :strict})
raw docstring

unbindclj

(unbind obj)

unbinds the contract to its var

(do (unbind #'-minus-) (bound? #'-minus-)) => false

unbinds the contract to its var

(do (unbind #'-minus-)
    (bound? #'-minus-))
=> false
raw docstring

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

× close