Core defns namespace.
Core defns namespace.
(applies? fn-var args)Checks if the passed parameter vector conforms to the type signature from the passed var's metadata. Also checks arity. Returns true if satisfied, otherwise false. Does not invoke the function.
Checks if the passed parameter vector conforms to the type signature from the passed var's metadata. Also checks arity. Returns true if satisfied, otherwise false. Does not invoke the function.
(defns name signature params body)Takes a name, type signature vector, parameter vector and a body and defines a new function using them. Behaves like defn, but adding additional metadata and adding :pre and :post conditions.
Adds(merges) the following map to metadata: {:signature - the type signature, vector if TypeSpecifications :p - parameter part of the type signature :r - result type :pretty-signature - the string representation of the type signature }
Creates the :pre condition such that applies the type predicate to the corresponding parameter and checks if all conformed. Creates :post condition that applies the result type predicate to the result.
Throws Exception if signature is not valid and/or function arity doesn't match with the signature.
Takes a name, type signature vector, parameter vector and a body and
defines a new function using them. Behaves like defn, but adding additional
metadata and adding :pre and :post conditions.
Adds(merges) the following map to metadata:
{:signature - the type signature, vector if TypeSpecifications
:p - parameter part of the type signature
:r - result type
:pretty-signature - the string representation of the type signature
}
Creates the :pre condition such that applies the type predicate to the
corresponding parameter and checks if all conformed. Creates :post
condition that applies the result type predicate to the result.
Throws Exception if signature is not valid and/or function arity
doesn't match with the signature.(deft type-name predicate)Defines a new TypeSpecification instance i.e. a new type.
Defines a new TypeSpecification instance i.e. a new type.
(prettify-sig signature)Converts a vector of TypeSpecifications to a vector of Strings representing their names.
Converts a vector of TypeSpecifications to a vector of Strings representing their names.
(pretty-sig fn-var)Returns the prettified signature from the passed var's metadata if any.
Returns the prettified signature from the passed var's metadata if any.
(sig fn-var)Returns the type signature from the passed var's metadata if any.
Returns the type signature from the passed var's metadata if any.
(signature-valid? signature params-count)Check if type signature vector conforms to the signature spec. Also checks if number of parameters in the signature is equal to the passed number. Returns true if both are true, otherwise throws Exception.
Check if type signature vector conforms to the signature spec. Also checks if number of parameters in the signature is equal to the passed number. Returns true if both are true, otherwise throws Exception.
(valid-result? fn-var arg)Checks if passed value conforms to the return type signature from the passed var's metadata. Returns true if satisfied, otherwise false. Does not invoke the function.
Checks if passed value conforms to the return type signature from the passed var's metadata. Returns true if satisfied, otherwise false. Does not invoke the function.
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 |