I can understand how that might be attractive to someone accustomed to a language that uses infix operators (as opposed to a Lisp), but I wonder how many people with a few weeks of Lisp under their belt would find the infix function worth the trouble.
This reminds me of when we introduced the C language at Schlumberger. There was a fellow who was accustomed using Pascal. Rather than adjust to C syntax, he wrote a set of macros that made C look like Pascal. Bill On Nov 28, 5:54 pm, Dmitri <[EMAIL PROTECTED]> wrote: > First of I'd like to say that I find Clojure to be an excellent > language, however I find the lack of infix operators makes reading > equations somewhat unnatural, eg: > > (+ (- (* x x) (* y y)) a) > > I ended up writing a simple function to handle infix notation > > (defn infix [arg1 func arg2 & args] > (let [result (func arg1 arg2)] > (if (= args nil) result (recur result (first args) (second > args) (rrest args))))) > > using that I find makes the code more readable: > > (infix (infix x * x) - (infix y * y) + a) > > I was wondering if there is a more elegant way to do this, and if it > could be added as a standard or contrib function. --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---