This is the mail archive of the kawa@sources.redhat.com 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]

Re: Class to use for lists from Java?


On Sat, 20 Jan 2001, Nic Ferrier wrote:

> >>> Jocelyn Paine <popx@pop3.ifs.org.uk> 20-Jan-01 10:00:02 AM >>>
> 
> >If I want to use Kawa lists in Java (declaring them, 
> >passing as method parameters, appending, etc.), 
> >what classname should I use, and are there Java-callable 
> >methods for car, cdr, cons, append, delete element and
> >insert element? 
> 
> gnu.kawa.util.Pair is a Scheme pair. It extends gnu.kawa.util.LList
> which is a lisp-linked list.
>
I think that's one of the things that confused me when I was looking at
the libraries. In an unoptimised implementation of lists, I'd expect all
lists to be implemented as chains of pairs (assuming that 'pair' is
understood in the Lisp sense, namely a structure with two fields used for
car and cdr respectively). So in Scheme, why are pairs a subclass of
lists? Can't a lisp-linked list always be represented as a Pair?

It sounds as though if I want to write Java methods that accept Scheme
lists, I need to use gnu.kawa.util.LList as the method parameter (and
perhaps be prepared to cope with some weird non-chain-of-pairs
representation), but if I'm creating the lists from scratch inside Java, I
can use the subclass gnu.kawa.util.Pair.
 
> They do most of what you want but I don't think there's an insert as
> lists don't work like that do they? It's basically a representation of
> the things you do with a scheme list so if you want to insert you have
> to split and re-make (AFAIK).
> 
You're completely right. I've been working with Common Lisp too long:
there, you'd still have to implement it as you suggest, but it is in the
language as one of the 4000 or however-many library procedures. Sorry.

> 
> >I'm sure I could find these by looking through 
> >the source libraries, but I'd like to use an interface 
> >that's guaranteed to remain the same as new versions 
> >of Kawa are released.
> 
> There are very few parts of Kawa like that at the moment. I know that
> Per is working on reducing dependancies in Kawa and this could involve
> things moving package. That's the most that's going to happen to these
> classes I would have thought.
> 
> 
> BTW: I've got it on my list of stuff to do to write an introduction
> to using Kawa from Java. Once Per has stabilised the dependancy stuff
> I hope to improve the javadoc as well.
> 
Look forward to that.

> 
> Nic
> 
Jocelyn


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]