​Well, you misunderstand it, as far as I know, clojure treat all fn as
object, so in your adder-maker example, clojure compiled two fn as object,
that's adder-maker itself and anonymous function it returns.
You must be right. As far as I know, the compiler is only called as part
of
What's the reason for asking? If you aim for making efficient code (that
is running very many times in tight loops), I think most of this will be
inlined by the JIT, as long as it is not confused by side effects and other
things.
I'm asking mostly because I want to better understand
A toy project I've worked intermittently on makes heavy use of *partial*
to dynamically build complex functions. I wish that *partial* was smart
enough to recompile its first argument, maybe taking advantage of whatever
type inference the compiler can make, but partial
Coming from a C++ background I'm not that familiar with functions as
first class values. We sort of do have them in C++ - as functors - ie
a class that has the function invocation operator defined. This class
can have storage as well, which means you can have a functor object
type which
2014-06-22 9:12 GMT+02:00 Reid McKenzie rmckenzi...@gmail.com:
since there's no other way that we can take a
function as a value prior to JVM 1.8 which has bytecode lambdas and
which the reference Clojure implementation doesn't leverage yet if ever.
Java 8 gained no such feature. Lambda
Okay. Functions as values. Go look at the IFn interface,
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java.
Thanks for the link - this helps! When the clojure compiler generates a
class type that conforms to this interface, does it generate a .java file
Okay. Functions as values. Go look at the IFn interface,
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java.
Thanks for the link - this helps! When the clojure compiler generates a
class type that conforms to this interface, does it generate a .java file
On Sunday, June 22, 2014 11:35:25 AM UTC-5, Herwig Hochleitner wrote:
2014-06-22 9:12 GMT+02:00 Reid McKenzie rmcke...@gmail.com javascript:
:
since there's no other way that we can take a
function as a value prior to JVM 1.8 which has bytecode lambdas and
which the reference Clojure
Suppose at my REPL I do...
(defn direct-report-oneplustwo [] (println (str Direct one plus two is
((fn [n] (+ 1 n)) 2) .)))
...then I presume that the compiler has compiled my
direct-report-oneplustwo function, and that this has included compilation
of my anonymous function (fn [n] (+ 1
On Saturday, June 21, 2014, Di Xu xudi...@gmail.com wrote:
Suppose at my REPL I do...
(defn direct-report-oneplustwo [] (println (str Direct one plus two is
((fn [n] (+ 1 n)) 2) .)))
...then I presume that the compiler has compiled my
direct-report-oneplustwo function, and that this has
A toy project I've worked intermittently on makes heavy use of *partial* to
dynamically build complex functions. I wish that *partial* was smart
enough to recompile its first argument, maybe taking advantage of whatever
type inference the compiler can make, but partial
Suppose at my REPL I do...
(defn direct-report-oneplustwo [] (println (str Direct one plus two is
((fn [n] (+ 1 n)) 2) .)))
...then I presume that the compiler has compiled my
direct-report-oneplustwo function, and that this has included compilation
of my anonymous function (fn [n] (+ 1 n)).
12 matches
Mail list logo