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?


>>> Jocelyn Paine <popx@pop3.ifs.org.uk> 21-Jan-01 10:22:10 AM >>>

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

Becaue LList is a little more abstract than that. It's a base
LinkedList definition. Pair is the top-level linked list definition.
Pair contains routines for the Scheme reader whilst List does not.

In fact the two are interlinked quite substanitally. My view is that
they shouldn't be (they aren't really seperate enough to be different
classes). But it's Per's compiler.  /8->


>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, can use the subclass gnu.kawa.util.Pair.

Why can't you accept Pair for lists? That's what I do when I need
them.

LList will probably be a Pair so there's no difference except Pair
gives you that little bit extra functionality.

(One of the biggest things wrong with Pair is that it's not called
LList).


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

You naughy person. <cue-language-war>You must know CL is the spawn of
beelzebub</-cue-lanaguge-war>


Nic

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