Op woensdag 8 juli 2015 05:20:51 UTC+2 schreef Herwig Hochleitner:
The way I would do it: Define multiply as a function calling (.multiply
amount ^Number x), for higher order usage, and then add an :inline function
to its metadata, which returns `(.multiply ~amount ~x).
That acts as a
:inline-arities tells the compiler, which arities (i.e. parameter counts)
should be inlined:
https://github.com/clojure/clojure/blob/9d70bc1051ec8117df6436e07474c586ea9e85b0/src/jvm/clojure/lang/Compiler.java#L6596
2015-07-09 9:49 GMT+02:00 Jo Geraerts j...@umask.net:
Op woensdag 8 juli 2015
Good call on the auto-boxing. I wasn't considering that before, but
obviously it is important.
Nice insight into :inline. I never really did understand the usefulness of
it before.
On Tuesday, July 7, 2015 at 10:20:51 PM UTC-5, Herwig Hochleitner wrote:
2015-07-07 15:04 GMT+02:00 Jo
Herwig Hochleitner schreef op 2015-07-08 05:20:
2015-07-07 15:04 GMT+02:00 Jo Geraerts j...@umask.net [1]:
* multiply(long x)
* multiply(double x)
* multiply(Number x)
In clojure i want to do something like
(defn multiply[^MonetaryAmount amount multiplicant]
(.multiply amount
consional = conditional
Typo sorry.
--
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
Note that posts from new members are moderated - please be patient with your
first post.
To
2015-07-07 15:04 GMT+02:00 Jo Geraerts j...@umask.net:
* multiply(long x)
* multiply(double x)
* multiply(Number x)
In clojure i want to do something like
(defn multiply[^MonetaryAmount amount multiplicant]
(.multiply amount multiplicant))
Function parameters in Clojure, are generally
You can do some consional instance? checks at runtime and type hint each method
call appropriately.
Java would determine the correct method based on the type information known to
the compiler at compile time.
You don't have that given in Clojure so you have to runtime check the type and
Hello,
I'm trying to create a small wrapper for the java money api. The api uses
method overloading.
For example:
https://github.com/JavaMoney/jsr354-api/blob/master/src/main/java/javax/money/MonetaryAmount.java
has methods
* multiply(long x)
* multiply(double x)
* multiply(Number x)
In