new set package



Stavros and I wrote a new set package (nset.lisp) for Maxima. You may view 
the 
documentation and download the distribution from 

http://www.unk.edu/acad/math/people/willisb

nset-1.0.tar.gz (about 17K) expands to a directory (nset-1.0) that 
contains
the source code, a sample initialization file, a testing routine,
a README file, and user documentation.

1. This is a *beta* distribution; we are asking for your input.

2.  Unlike other Maxima set packages we know of, nset treats sets
and lists as distinct objects. Thus

(C1) set(x,[x],set(x));

(D1)                             {x, {x}, [x]}
(C2) 

3. There are 27 user functions in nset; here is a short demonstration of 
its more interesting functions

(C2) extremal_subset(set(-2,-1,1,3),abs);

(D2)                                  {3}
(C3) extremal_subset(set(-2,-1,1,3),abs,min);

(D3)                               {- 1, 1}
(C4) equiv_classes(set(0,1,2,3,4,5,6),lambda([x,y],remainder(x-y,2)=0));

(D4)                       {{0, 2, 4, 6}, {1, 3, 5}}
(C5) equiv_classes(set(0,1,2,3,4,5,6),lambda([x,y],remainder(x-y,3)=0));

(D5)                      {{0, 3, 6}, {1, 4}, {2, 5}}
(C6) 
partition_set(set(x+1,x^2+3*x+2,x+9),lambda([p],constantp(gcd(p,x+1))));
 
(D6)                   [{x + 1, x^2  + 3 x + 2}, {x + 9}]
(C7) cartesian_product([a,b],[1,2]);

(D7)                   {[a, 1], [a, 2], [b, 1], [b, 2]}
(C8) subpowerset([u,n,k],2);

(D8)                       {{k, n}, {k, u}, {n, u}}
(C9) powerset([u,n,k]);

(D9)        {{}, {k}, {k, n}, {k, n, u}, {k, u}, {n}, {n, u}, {u}}

(C10) flatten(set(set(a),set(b),set(b,c)));

(D10)                              {a, b, c}
(C11) 

4. While developing nset, we discovered bugs in "orderlessp" and "is":

(C10) orderlessp([x],[rat(x)]);

Type-error in KERNEL::OBJECT-NOT-LIST-ERROR-HANDLER:
   #:|x1163| is not of type LIST

(C11) is([rat(x)]=[rat(x)]);

(D11)                                FALSE
(C12) 

We've reported these bugs and invite folks to fix them. Additionally,
the sample initialization file contains fixes for setup_autoload
and friends. 

5.  We've tested nset with Maxima / GCL 5.5 under Windows XP and 
Maxima / CMUCL 5.9.0rc3 under Linux. We've only tested the 
setup_autoload fixes under CMUCL. The generic-autoload function
has Lisp version specific code  -- these fixes need more testing 
under different Lisp / Maxima versions. 

To get nset to work under commercial Macsyma, you'll need to change 
(in-package "MAXIMA") to (I think) (in-package "CLIMAX") and you'll 
need to comment out the four lines that involve the $put or put 
functions (or figure out what Macsyma uses instead of put and $put). 

6. test-nset.mac is a testing routine.  Copy it to your /tests
directory and add "test-nset" to the list of files in tests.lisp.
I've only run the test under Maxima 5.9.0rc3.

Again, nset is a beta distribution. Please send us your bug
reports and suggestions for improvement.

Barton