Suppose I write (defn foo [x] (let [f (. Math log 0.5)] (* f x)))
Does the Clojure compiler calculate the constant expression (. Math log 0.5) once, or at every function call? Can I check this somehow, i.e. look at the generated code, with reasonable effort? If it doesn't optimize it, I'd have to write (let [f (. Math log 0.5)] (defn foo [x] (* f x))) which is fine as well for this minimal example, but less clear in real-life code. I'd then rather write a small macro to evaluate the constant expression, but before doing so I'd like to know if I really have to. Konrad. --~--~---------~--~----~------------~-------~--~----~ 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 clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---