Re: A Collections Framework?



s> In what way do CL generic functions and CLOS fail to be many times
s> more powerful and better at expressing interfaces than Java
s> interfaces?

Is this "Have you stopped beating your wife?" sort of a question? :)

I do not think that there is any problem with CLOS.

A problem with "collections framework" for CL is just that nobody wrote one.

You see, there are lots of wealthy companies which use Java, and they can afford to hire lots of programmers to write that framework for Java.

There are less companies working with CL, and, apparently, they address their needs with existing solutions, so there is no great need to a great unified library. It would be nice to have one, but isn't strictly required, as one can use lists, or hash tables, or FSet library, or one of btree libraries, or uses pieces of cl-contaniers which actually work, or write their own implementation.

So lack of an unified library is not a showstopper. One can benefit from it providing unified interfaces so he can switch between different underlying implementations and see if there is a speedup. But he can as well write his own adapter functions for this, that might be just few lines of code...

I guess a problem with it is that framework which really covers everything is a tremendous work. You can easily write adapter functions which will work both for balanced trees and for hash-tables (for example), but taking all possible trait combinations into account is hard.

To start with, there is a problem with classification even before you come to an implementation.
There are associative containers, iteratable containers, searchable ones, ones where you can insert in the middle, into one or both of its ends, or it just doesn't matter where you insert, there are ones which support indexing and ones which do not...
Some of these traits are orthogonal and some are not. For example, if collection provides index access, then for sure it is ordered and iteratable.

Then there are multiple ways to look at one particular collection -- e.g. if you have a balanced tree with pairs, you can either consider it as an associative container or not.
Maybe you want to provide both interfaces?

I don't know if it is possible to copy Java or C++ collection library. Those are different languages and choices library writers have made might be not really optimal for CL.

So a problem is on conceptual level, not technical level.

If you're a Lisp neophyte, you might be over-excited with language features. Don't forget that great language features do not write code for you, they just let you to express your thoughts in more clean way.


.



Relevant Pages

  • Re: [ANN] jfli - a Java FLI for LispWorks
    ... Based on what you write there, I managed to run it with the Java SDK - see my ... >> in using Java libraries, the ability to create instances of Java classes and ... > Well, a nice library, such as SWT/Eclipse, often offers interfaces. ... Yes, although even in those cases it is sometimes more convenient to subclass, ...
    (comp.lang.lisp)
  • Re: Automating simple web forms
    ... (written in Java). ... I remember having seen some libraries providing Ruby ... interfaces for it. ...
    (comp.lang.ruby)
  • Re: Any Clojure users here?
    ... I mainly wanted to correct your claim that with ABCL you either benefit from the CL standard or from the Java API, ... Java libraries, and avoid using any ABCL-specific features, and then ... Clojure and lose almost *everything* you'd lose by using Clojure, ...
    (comp.lang.lisp)
  • Re: Any Clojure users here?
    ... Java libraries, and avoid using any ABCL-specific features, and then ... ABCL cannot directly call into C. ... Clojure and lose almost *everything* you'd lose by using Clojure, ...
    (comp.lang.lisp)
  • Re: VB language extensions wishlist
    ... IDE or task-specific libraries ... Ability to define interfaces and classes separately. ... ' one strong ref, one weak ... One could access Public items in JunkStuff by using ... ...
    (microsoft.public.vb.general.discussion)