On Dec 31, 11:49 am, Konrad Hinsen <konrad.hin...@laposte.net> wrote:
> 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?
Every call. Clojure does not know that Math/log is a pure function.
> Can I check this somehow,
> i.e. look at the generated code, with reasonable effort?
Currently there is no bytecode dump facility, but Java bytecode tools
should work on AOT compiled class files.
Rich
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---