New Era for Clojure: Infix Syntax! - Flexiana

New Era for Clojure: Infix Syntax!

Apr 1, 2026 Company
avatar

Jiri Knesl

Founder & CEO

On this page

Acknowledgements

Share article

After years of watching talented developers bounce off Clojure’s prefix notation, we at Flexiana decided it was time to act. Today we’re open-sourcing **Infix** — a library that brings natural, readable mathematical and data-processing syntax to Clojure, while compiling to standard Clojure forms with zero runtime overhead.

This is not a toy. This is the future.

The Problem Nobody Was Brave Enough to Solve

Let’s be honest. We’ve all been in that meeting where a data scientist looks at

clojure
(+ (* a b) (/ c d))

and quietly opens a Python tab. We’ve all watched a business analyst try to read a pricing rule written as `(<= (count (:items order)) (* 2 (get-in config [:limits :base])))` and slowly lose the will to live.

Prefix notation is elegant. It is consistent. It is *theoretically* superior. But so is Esperanto, and we all know how that worked out.

The Solution

Infix lets you write this:

clojure
(infix a * b + c / d)

and it compiles to `(+ (* a b) (/ c d))`. Operator precedence works exactly as you’d expect from every other language you’ve ever used. Because we studied those languages. Carefully.

But we didn’t stop at arithmetic.

Threading as Infix Operators

`clojure
(infix users
       ->> (filter :active?)
       ->> (map :email)
       ->> (take 10))

Clojure’s threading macros become first-class infix operators with the lowest precedence, because data flows left to right. Like water. Like time. Like *progress*.

Arrow Lambdas

clojure
(map (infix x => x * x + 1) [1 2 3])
;; => [2 5 10]

Clean, readable anonymous functions. No `#(…)` gymnastics. No counting percent signs.

Function Definitions

clojure
(infix-defn calculate-discount [subtotal tier quantity]
  (let [rate (cond (tier = :premium) 0.15
                   (quantity >= 10) 0.10
                   :else 0.05)]
    (min (subtotal * rate) 100)))


Read that out loud. Show it to your product manager. Watch them nod instead of frown.


Early Returns

clojure
(infix-defn safe-divide [x y]
  (when (= y 0) (return nil))
  (/ x y))

Guard clauses. In Clojure. We went there.


Function Call Syntax

clojure
(infix max(3, 5) + min(1, 2))   ;; => 6
(infix Math/sqrt(9) * 2)         ;; => 6.0

Familiar `fn(args)` notation, because sometimes you just want to feel at home.

How It Works

Everything is a macro. The `infix` macro uses a Shunting Yard parser to transform your expressions into standard Clojure forms at compile time. There is no interpreter. There is no string parsing. There is no runtime cost. Your production Clojure is exactly the same Clojure it always was — we just let you *write* it differently.

The entire library is roughly 300 lines of code across four namespaces: a parser, a precedence table, a compiler, and the public API. We encourage you to read it. It’s well-commented and, dare we say, rather elegant.

Installation

Add as a git dependency:

clojure
;; deps.edn
io.github.flexiana/infix {:git/url "https://github.com/Flexiana/infix"
                           :git/tag "v1.0.0"
                           :git/sha "<sha>"}

Or clone it:
bash git clone https://github.com/Flexiana/infix.git

“But This Is Heresy”

We know.

We’ve heard the arguments. S-expressions are homoiconic. Prefix notation eliminates ambiguity. Operator precedence is a source of bugs. Rich Hickey didn’t design Clojure so you could write `a + b` like some *Java developer*.

To which we say: you’re absolutely right. And yet here we are, shipping it anyway. On April 1st, no less — the only day of the year when the Clojure community might forgive us.

The library is real. The tests pass. The macros expand. Whether you *should* use it is a question we leave to your conscience, your team lead, and your local REPL priest.

What’s Next

Infix 1.0.0 is feature-complete and ready for production use. Future enhancements may include:

– Collection operators (`in`, `not-in`)

– Enhanced error messages

– Pattern matching integration

– A formal apology to the Lisp community

Try It

The code is at [github.com/Flexiana/infix](https://github.com/Flexiana/infix). It’s Apache-2.0 licensed. Star it, fork it, or use it as evidence in your next “Clojure is pragmatic, actually” argument.

We regret nothing.

Flexiana is a software consultancy that builds products in Clojure. We take our craft very seriously. Usually.

Like what you read?

Become a subscriber and receive notifications about blog posts, company events and announcements, products and more.