Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Contracts programming

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 docs
Octocat-spinner-32 examples Added simplest example January 22, 2013
Octocat-spinner-32 src
Octocat-spinner-32 .gitignore org-modifying index January 22, 2013
Octocat-spinner-32 README.md
Octocat-spinner-32 epl-v10.html initial commit April 28, 2012
Octocat-spinner-32 pom.xml
Octocat-spinner-32 project.clj
README.md

clojure.core.contracts

Contracts programming for Clojure.

In progress.

Based on Trammel and clojure-contracts.

Releases and Dependency Information

Latest stable release: 0.0.1

Leiningen dependency information:

[org.clojure/core.contracts "0.0.1"]

Maven dependency information:

<dependency>
  <groupId>org.clojure</groupId>
  <artifactId>core.contracts</artifactId>
  <version>0.0.1</version>
</dependency>

Example Usage

    (use 'clojure.core.contracts)

    (def secure-doubler
      (with-constraints
        (fn [n] (* 2 n))
        (contract doubler
          "ensures doubling"
          [x] [number? => (= (* 2 x) %)]
          [x y] [(every? number? [x y])
                   =>
                 (= (* 2 (+ x y)) %)])))

    (secure-doubler 10)
    ;=> 20

Refer to docstrings in the clojure.core.contracts namespace.

Developer Information

Change Log

  • Release 0.0.1 on 2012.06.01
    • Rolled in contract, with-constraints and provide from Trammel

Copyright and License

Copyright (c) Rich Hickey, Michael Fogus and contributors, 2012. All rights reserved. The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound bythe terms of this license. You must not remove this notice, or any other, from this software.

Something went wrong with that request. Please try again.