On Feb 5, 12:34 pm, Nicolas Buduroi <nbudu...@gmail.com> wrote:
> Hi, I'm searching for a way of applying a sequence of arguments to a
> Java method, but haven't found anything yet. Tried to write a macro
> for it and don't even see how that would be possible. Is there a way
> to do that?
>
> Thanks
>
> - budu


You could also use memfn.

user=> (def div (memfn divide val))
#'user/div
user=> (def x (BigInteger. "6"))
#'user/x
user=> (def y (BigInteger. "2"))
#'user/y
user=> (div x y)
3
user=> (apply div [x y])
3

Though it requires reflection.  To deal with that you could make your
own type-hinted function:

user=> (defn div [#^BigInteger x #^BigInteger y] (.divide x
y))
#'user/div
user=> (apply div [x y])
3

-- 
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 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

Reply via email to