Sure. That's easy in Lumen: https://github.com/sctb/lumen/commit/6410c8cc2de66d1976515bd...
Is it possible to use this technique to introduce, say, infix arithmetic operators?
Yep! I wrote a macro to swap any instance of `x with the previous expression. Meaning, it allows you to write:
(foo `= (x `+ y))
rather than (= foo (+ x y))
The reason it was so easy to do this is because `foo is shorthand for (quasiquote foo). So the macro simply steps through a body of code, looks for any instance of quasiquote followed by an atom, and then swaps it with the previous expression.But more generally, it's easy to write a macro to do whatever you want. If you really want infix expressions all of the time, I could imagine writing a macro which matches the pattern (... + ... + ...) and replaces it with (+ ... ... ...)
That's made-up notation, but the idea is just "look for some set of symbols, like + or /, which occur within a list in between all of the other elements, and then move the symbol to the front of the list."
The power is available to you, but whether you choose to use it is a separate question. Prefix notation tends to be a win for everything except math. And even for math, it's usually a matter of code formatting. Rather than
(- (* 2 (/ (+ x y) (+ a b c))) 1)
try (- (* 2
(/ (+ x y)
(+ a b c)))
1)
or (let u (+ x y)
(/= u (+ a b c))
(*= u 2)
(-- u))
Once Laarc has support for indentation-as-parens, it'd look like: let u (+ x y)
/= u (+ a b c)
*= u 2
-- u
which is rather pretty, and has no ambiguity. One of pg's essays on Arc mentioned this feature, and it seems like a good idea, so I hope to pursue it.