Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

80 lines (57 sloc) 1.935 kB

match

An optimized pattern match and predicate dispatch library for Clojure. Currently the library only implements pattern matching. It supports Clojure 1.2.0 and later as well as ClojureScript.

You can find more detailed information here.

Alpha Status

It's important to note that core.match is alpha quality software. There are many known issues. In particular if your project depends on AOT do not use core.match at this time. Patches for any and all issues welcome!

Releases and dependency information

Latest alpha: 0.2.0-alpha11

Leiningen dependency information:

[org.clojure/core.match "0.2.0-alpha11"]

Maven dependency information:

<dependency>
  <groupId>org.clojure</groupId>
  <artifactId>core.match</artifactId>
  <version>0.2.0-alpha11</version>
</dependency>

Example Usage

From Clojure:

(use '[clojure.core.match :only (match)])

(doseq [n (range 1 101)]
  (println
    (match [(mod n 3) (mod n 5)]
      [0 0] "FizzBuzz"
      [0 _] "Fizz"
      [_ 0] "Buzz"
      :else n)))

From ClojureScript:

(ns foo.bar
  (:use-macros [clojure.core.match.js :only [match]]))

(doseq [n (range 1 101)]
  (println
    (match [(mod n 3) (mod n 5)]
      [0 0] "FizzBuzz"
      [0 _] "Fizz"
      [_ 0] "Buzz"
      :else n)))

Developer information

Copyright and license

Copyright © 2010-2012 David Nolen, Rich Hickey & contributors.

Licensed under the EPL (see the file epl.html).

Jump to Line
Something went wrong with that request. Please try again.