Incanter supports this with the $= prefix:
($= 7 + 8 - 2 * 6 / 2)

http://data-sorcery.org/2010/05/14/infix-math/

Might be worth looking at...


On Thursday, April 3, 2014 11:17:32 PM UTC-5, Joshua Brulé wrote:
>
> Proposal:
>
> For an *odd* number of forms a, x, b, ...
>
> {a x b x c ...} => (x a b c ...)
> {a x b y c ...} => (*nfx* a x b y c ...)
>
> Reasoning:
>
> Even after a lot of practice, prefix math is still harder (at least for 
> me...) to read than non-prefix math. The [], () and <> matching delimiters 
> are already taken, but {} is only used for an even number of forms (and, in 
> fact, throws an exception on an odd number of forms.)
>
> ; trumped-up examples
> (defn harmonic-mean [x1 x2]
>   {{2 * x1 * x2} / {x1 + x2}})
>
> (defn fib [n]
>   (cond
>     {n = 0} 1
>     {n = 1} 1
>     :else {(fib {n - 1}) + (fib {n - 2})}))
>
> Basically, I'm claiming a solid win on readability, and no risk of 
> breaking any existing code.
>
> I realize there's a certain risk of mistaking curly-infix for a map 
> literal when reading code, but I think it's minimal. To me, at least, {x + 
> y} just doesn't look like a map.
>
> Thoughts?
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to