This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: calling scheme procedure from java and passing a list as argument...
- From: Per Bothner <per at bothner dot com>
- To: Damien Mattei <damien dot mattei at unice dot fr>, kawa at sourceware dot org
- Date: Thu, 17 Sep 2015 11:54:38 -0700
- Subject: Re: calling scheme procedure from java and passing a list as argument...
- Authentication-results: sourceware.org; auth=none
- References: <55FABBA1 dot 4080106 at unice dot fr>
On 09/17/2015 06:09 AM, Damien Mattei wrote:
hello again,
suppose i have a java code (the case is running on tomcat web server but
that's make no difference)
and i want to pass a list to a scheme routine, i have two questions:
-is there a way to call a scheme procedure in kawa,i suppose the answer
is yes but how?
( i know i can do it making a method in a kawa class definition and call
the method)
This page talks about *evaluating* Scheme from Java:
http://www.gnu.org/software/kawa/Evaluating-Scheme-expressions-from-Java.html
If you have a Scheme Proecdure object you can call by using one of the
apply methods. For example:
Object[] args = {x, y};
Object result = myProc.applyN(args);
or:
Object result = myProc.apply2(x, y);
- but how can i pass a list as parameter, what is the equivalent of
scheme list in java or kawa??
I would greatly appre"ciate a little example...
To create a list you can use one of the static methods in gnu..lists.LList,
like makeList or list1 ... list4.
It's usually best to do as much as you can in Scheme: It is easier (and
better documented with a more stable API) calling Java from Scheme
than calling Scheme from Java.
--
--Per Bothner
per@bothner.com http://per.bothner.com/