API for clojure.core.contracts - Contracts programming in Clojure 0.0.7 (in development)


Full namespace name: clojure.core.contracts

Overview

The public contracts programming functions and macros for clojure.core.contracts.

Public Variables and Functions



provide

macro
Usage: (provide & kontracts)
Provides the Var manipulation macro offering ex post facto application of contracts
to existing functions.

    
    
    Source
  


with-constraints

function
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
  

clojure.core.contracts.constraints





Public Variables and Functions



<-

function
Usage: (<- p q)
Converse implication

    
    
    Source
  


<=>

function
Usage: (<=> p q)
Logical equality

    
    
    Source
  


=

function
Usage: (= l#)
       (= l# r#)
Curried version of #'clojure.core/=

    
    
    Source
  


==

function
Usage: (== l#)
       (== l# r#)
Curried version of #'clojure.core/==

    
    
    Source
  


defconstrainedfn

macro
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
  


except

function
Usage: (except p q)
P except Q

    
    
    Source
  


implies

function
Usage: (implies p q)
Logical implication

    
    
    Source
  


in

function
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
  


not=

function
Usage: (not= l#)
       (not= l# r#)
Curried version of #'clojure.core/not=

    
    
    Source
  


whitelist

function
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
  


xor

function
Usage: (xor p q)
Exclusive or

    
    
    Source
  

clojure.core.contracts.impl.transformers





Types



Hoc

record

    Fields: [field desc]
Protocols:
Interfaces: clojure.lang.IHashEq, clojure.lang.IKeywordLookup, clojure.lang.ILookup, clojure.lang.IObj, clojure.lang.IPersistentMap, java.io.Serializable, java.util.Map

Public Variables and Functions



->Hoc

function
Usage: (->Hoc field desc)
Positional factory function for class clojure.core.contracts.impl.transformers.Hoc.

    
    
    Source
  


map->Hoc

function
Usage: (map->Hoc m#)
Factory function for class clojure.core.contracts.impl.transformers.Hoc, taking a map of keywords to field values.

    
    
    Source
  

clojure.core.contracts.impl.utils





Public Variables and Functions



constraint?

function
Usage: (constraint? sym)
Determines if a symbol represents a
core.contracts constraint.

    
    
    Source
  


defcurried

macro
Usage: (defcurried name doc meta args & body)
Builds another arity of the fn that returns a fn awaiting the last
param

    
    
    Source
  


defcurry-from

macro
Usage: (defcurry-from namespace & names)
Builds a pass-through curried fn for each name.

    
    
    Source
  
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.