Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Forgive my terrible macroing but, if your really must, you can:

    (defmacro ord-compare [a ord b]
      `(if (or (= > ~ord) (= < ~ord)) (~ord ~a ~b) "Use > or < to compare."))
  
    (ord-compare 3 > 2)
Edit: there's also incanter.inflix, which will translate inflix notation into clojure like notation.

https://github.com/liebke/incanter/blob/e1235cf9ffa2e528823e...

Check out the tests for how to use it:

https://github.com/liebke/incanter/blob/aa71f1135c3beb7bf7a4...

A good example:

    ; $= translates inflix to prefix notation. 
    ($= 3 <= (5 * 2/7))  ;will give you false.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: