The public contracts programming functions and macros for clojure.core.contracts.
Usage: (provide & kontracts)
Provides the Var manipulation macro offering ex post facto application of contracts to existing functions.Source
Usage: (with-constraints f)
(with-constraints f c)
(with-constraints f c & more)
A contract combinator. Takes a target function and a number of contracts and returns a function with the contracts applied to the original. This is the preferred way to apply a contract previously created using `contract` as the use of `partial` may not work as implementation details change.Source
Usage: (defconstrainedfn name & body)
Defines a function using the `contract` vector appearing after the arguments.
(defconstrainedfn sqr
[n] [number? (not= 0 n) => pos? number?]
(* n n))
Like the `contract` macro, multiple arity functions can be defined where each argument vector
is immediately followed by the relevent arity expectations. This macro will also detect
if a map is in that constraints position and use that instead under the assumption that
Clojure's `:pre`/`:post` map is used instead.
Source
Usage: (in e & args)
Takes an item and determines if it falls in the listed args. This can be used most effectively for numbers since any numbers in a vector represent a range of values determined by the same arguments as given to `range`.Source
Usage: (whitelist wl things)
Takes a thing with keys (i.e. maps or sets) and checks if it contains only the keys listed in the given whitelist.Source
Usage: (->Hoc field desc)
Positional factory function for class clojure.core.contracts.impl.transformers.Hoc.Source
Usage: (map->Hoc m#)
Factory function for class clojure.core.contracts.impl.transformers.Hoc, taking a map of keywords to field values.Source
Usage: (constraint? sym)
Determines if a symbol represents a core.contracts constraint.Source
Usage: (defcurried name doc meta args & body)
Builds another arity of the fn that returns a fn awaiting the last paramSource
Usage: (defcurry-from namespace & names)
Builds a pass-through curried fn for each name.Source