looks like you can use AFn() in your example
ie.
static IFn assoc = new AFn(){
@Override
public Object invoke(Object m, Object k, Object v) {
return RT.assoc(m, k, v);
}
};
(code from clojure.lang.Var.assoc)
On Sat, Nov 3, 2012 at 12:51 AM, JvJ <[email protected]> wrote:
> I'm writing a Java interface to some Clojure code, and some of the code
> needs functions as parameters.
> I'd like to be able create objects from anonymous inner classes.
> Something like this:
>
> func = new IFn(){
> public Object invoke(obj1,...){
> //code in here
> }
> };
>
> I'd like to be able to know if there's a way to do this easily without
> overloading like 20 methods or whatever.
>
> I suppose I could implement my own abstract class and extend that, but I
> don't want to if I don't have to.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
I may be wrong or incomplete.
Please express any corrections / additions,
they are encouraged and appreciated.
At least one entity is bound to be transformed if you do ;)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en