On 25 tammi, 00:26, rob <r.p.l...@gmail.com> wrote:
> Hi,
>
> I was wondering if anyone has tried somehow calling Jython functions
> from within Clojure, and how you went about doing this if so.  I have
> not used Jython, but I would imagine the Jython interpreter can be
> invoked in the same way as any other java code, and Python programs
> can be run within it.  However I wonder if it would be possible to
> somehow call individual python functions from Clojure.  Like I said, I
> have not tried this yet, so it might actually be straightforward and
> obvious.  I'm just wondering if anyone has tried doing this.

The procedure I've used most with Jython (and found to be quite
robust) is to define an interface in Java, and then implement (extend)
that interface in Jython. Then just create an instance of that object
with JythonInterpreter, and you get a valid Java object implementing
your interface. Here's some description on that topic:
http://jythonpodcast.hostjava.net/jythonbook/chapter10.html

I haven't actually tried to combine it with Clojure, but with this
"interface approach" it should be a cakewalk, since Clojure calls to
Java are direct with no "magic translation layers". Calling Clojure
from Jython could be a bit trickier, though, since Jython has these
translation layers.

Best Regards,
Joonas

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