This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On 2/22/06, Per Bothner <per@bothner.com> wrote:> But there is some other problem I didnt master yet. A while ago[1]
Shoeb wrote the following to the list.
I have a list of Java objects in a Java list (e.g. java.util.ArrayList).
I have a scheme function that takes a Scheme list as a parameter.
How do I pass my Java list to the scheme function?
(In my scheme function I want to treat the list as a Scheme list so that I can invoke 'car' and 'cdr' on it.)
I tried creating a new Pair() object in my Java code, adding my Java objects to it (using the 'add' method since Pair implements the List interface), and passing it as an argument to the scheme function. I get the following exception:
Pair is the wrong place to look, since converting a zero-size java.util.List to a Scheme list should return an empty list - which contains no Pairs.
The right place to look is Pair's super-class gnu.lists.LList, which has the makeList convenience function: http://www.gnu.org/software/kawa/api/gnu/lists/LList.html#makeList(java.util.List)
Unfortunately, no documentation, but it should be fairly obvious. -- --Per Bothner per@bothner.com http://per.bothner.com/
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |