Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Contract programming for Clojure.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 project.clj
README.md

Clojure-contracts

Clojure-contracts is a library for contract programming in Clojure.

WARNING: this is a work in progress. It's not feature complete and may contain bugs.

Usage

See the tutorial.

A quick example:

user> (defn foo [x] (+ x 5))

user> (foo nil) ;=>
 No message.
 [Thrown class java.lang.NullPointerException]

user> (provide-contract foo (c/=> number? number?))

user> (foo nil) ;=>
 Precondition failed for var #'user/foo 
 Expecting: number? 
 Given: nil

See the tutorial for details.

Installation

Add [clojure-contracts "0.0.1-SNAPSHOT"] to your project's dependecies. Clojars page.

License

Copyright (C) 2012 Dmitri Naumov

Distributed under the Eclipse Public License, the same as Clojure.

Something went wrong with that request. Please try again.