core.match - A pattern matching library for Clojure[script] - is available for self-hosted ClojureScript. It means that it can run in Planck and Klipse.

The code is available as a fork of core.match called abbinare.

The approach is similar to what Mike Fikes did for core.async with andare.

Both names comes from italian: “andare” means “go” and “abbinare” means match (in the sense of combine).

match

In order to use core.match in Klipse, simply require it and Klipse will fetch abbinare code from its analysis cache repository:


(require '[cljs.core.match :refer-macros [match]])

In order to use core.match in Planck, add abbinare as a dependency with:

 [viebel/abbinare "1.10.597"]

Here is a quick demo - running in your browser - of a solution to the famous Fizz buzz interview question with core.match:

(with-out-str (doseq [n (range 1 11)]
  (println
    (match [(mod n 3) (mod n 5)]
           [0 0] "FizzBuzz"
           [0 _] "Fizz"
           [_ 0] "Buzz"
           :else n))))

Want more core.match cool stuff in your browser? Read this core.match interactive tutorial.