Skip to content
First-class patterns for Clojure. Made with love, functions, and just the right amount of syntax.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Join the chat at Build Status

Clojars Project Clojars Project

Queen: Hmm...

Who's been painting my roses red?
Who's been painting my roses red?

Who dares to taint with vulgar paint
the royal flower bed?

For painting my roses red
someone will lose his head.

Three: Oh no, your majesty, please, it's all his fault!
Two: Not me, Your Grace. The Ace! The Ace!
Queen: You?
Ace: No, Two!
Queen: The Deuce, you say?
Two: Not me, the Tres!
Queen: That's enough! Off with their heads!

Akar is a pattern matching library for Clojure, with focus on simplicity and abstraction.

Akar patterns are first-class values (just functions, actually), that can be manipulated, composed, abstracted over, like any other values. In fact, this is exactly how various pattern operations, such as guards, alternation, and views are implemented in Akar.

The library also features a syntactic layer that makes common use cases convenient, but at the same time stays true to the first-class spirit of the core model.

Akar (IPA: [ɑkɑɾ], Devanagari: आकार) is a Sanskrit/Marathi word for shape. The logo is a Saraswati Kolam, a diagrammatic representation of Hindu goddess of wisdom.

To learn more, read the Akar tutorial and FAQs.

Releases and Dependency Information

# Specific Akar projects
[akar/akar-core "1.0.0"]

# All Akar projects
[akar "1.0.0"]


  (:require [akar.syntax :refer [match]]
            [ :as xml]))

; Example borrowed from
(defn italics [xml-node]
  (match xml-node
         {:tag :i :content (:seq [contents])} (println contents)
         {:tag :node :content nodes}          (doseq [child nodes] (italics child))
         :_                                   nil))

(def xml-doc
  (xml/parse (
                  <node>This is <i>some</i> text content.
                    <node>This is <i>deeper</i> stuff.</node>
                  <node>I am some text.
                    <title>I am <i>a title</i>.</title>
                    This is a sentence with an <i>italicized</i> entry.

(italics xml-doc)

; prints:
;   some
;   deeper
;   italicized


Do you wish to contribute to Akar? Splendid! Get started here.


Copyright © 2018 Rahul Goma Phulore, Rahul Kavale

Distributed under Apache License 2.0.

You can’t perform that action at this time.