                    LIST and SET Operations for the HP-48GX
                         By Gjermund Skailand, 20 July 1998
                                Revision 1

SETS is a library for basic operations on sets (union, intersection, 
set difference and symmetric difference). The library is written in sys-RPL. 

This package include: 
 SETS: an auto-installing library 838 
 SETS.src: source code   
 SETS.txt: this file
 LISTSETS.txt: general information by Dave Allen  
  
The HP48 calculator supports list objects which supports an ordering of its 
elements and can have duplicate members. Sets does not support ordering and 
does not consider duplicates.

TOSET converts a list to a set by remowing duplicate members from the list.
MEMBER tests set membership, that is, it checks to see if an object is 
included in a set (or list).  It only searches the top level. 

UNION and INTERSECT implement set union and intersection, while DIFF and 
SDIFF are set difference and symmetric difference.  

NOTE: If the input given are not sets (that is, they contain duplicates), 
      duplicates may appear in the results.  
      Tagged objects are supported.  

These four operations are the main arithmetic operations for sets, with the 
following similarities to arithmetic and boolean operations:

   ARITHMETIC            BOOLEAN            SET OPERATION
   ----------            -------            -------------
   addition (+)          OR (inclusive)     union
   subtraction (-)       AND NOT            difference
   multiplication (*)    AND                intersection
   division (/)          XOR                symmetric difference

EXAMPLES

{ 1 2 } { 3 4 } UNION --> {1 2 3 4}   { 1 2 } { 1 2 } UNION  -->  { 1 2 }
{ 1 2 } { 3 4 } INTERSECT --> { }     { 1 2 } { 2 3 } INTERSECT  -->  { 2 }
{ 1 2 } { 3 4 } DIFF --> { 1 2 }      { 1 2 } { 2 3 } DIFF  -->  { 1 }
{ 1 2 } { 3 4 } SDIFF --> {1 2 3 4}   { 1 2 } { 2 3 } SDIFF  -->  { 1 3 }

{ 1 2 3 } TOSET -->  { 1 2 3 }        { 1 2 3 2 } TOSET -->  { 1 2 3 }     
{ 1 2 3 } 2 MEMBER  -->  1            { 1 2 3 } 4 MEMBER  -->  0

Credits given to  
  Dave Allen (ref. LISTSETS.txt )
  HP-RPL Manual, (TOSET copied from chapter 2.8.1) 
  Mika Heiskanen and Claude-Nicolas Fiechter for their JAZZ compiler. 

The library is compiled by use of JAZZ v. 6.6LE  on HP48GX version HP48 R.

The files are free to use with no responsibility taken for possible errors or 
consequences by use of these files. If the files are copied it is requested 
that all files are kept together.  
1998-07-20 Gjermund Skailand
gjermund.skailand@dnv.com
