cleavir set
1.0.0A set data structure.
This system defines a basic set data structure, which is useful for various purposes.
Sets are especially used in BIR. The sets here are just the usual mathematical sense
of a collection of different elements. The usual operations, such as union
and
membership checks, are defined. Some have CL's "n" prefix to indicate that they may
be carried out destructively for efficiency.
The set
class is a wrapper over one of two implementations, a hash and a list. The
hash is used by default; if you want to use lists (which are more reproducible, but do
not have constant-time set membership checks), change the features code at the top of set.lisp
.
In the future, it would probably be useful to establish a more compact set representation, as a bitfield with accompanying universe. Then different sets from the same universe could be more compactly and efficiently used. The trick would be keeping the universe stable in the face of modifications to the BIR or whatever else.
System Information
Definition Index
-
CLEAVIR-SET
No documentation provided.-
EXTERNAL CLASS SET
A collection of different things.
-
EXTERNAL FUNCTION ARB
- SET
Return an arbitrary element of SET. If SET has no elements, return no values.
-
EXTERNAL FUNCTION COPY-SET
- SET
Return a fresh set containing all the elements of SET.
-
EXTERNAL FUNCTION DIFFERENCE
- RESULT-TYPE
- MINUEND
- SUBTRAHEND
Return an object containing all the elements of MINUEND that are not present in SUBTRAHEND. RESULT-TYPE may be SET or LIST.
-
EXTERNAL FUNCTION EMPTY-SET
Return a fresh set containing no elements.
-
EXTERNAL FUNCTION EMPTY-SET-P
- SET
Return true iff the given set has no elements.
-
EXTERNAL FUNCTION EVERY
- P
- SET
Return true iff every element of SET is true under PREDICATE.
-
EXTERNAL FUNCTION FILTER
- RESULT-TYPE
- PREDICATE
- SET
Return an object containing all the elements of SET that are true under the PREDICATE. RESULT-TYPE may be SET or LIST.
-
EXTERNAL FUNCTION MAKE-SET
- &REST
- ELEMENTS
Return a fresh set containing the given elements, and only those elements.
-
EXTERNAL FUNCTION MAPSET
- RESULT-TYPE
- F
- SET
Map over the elements of SET. Analogous to MAP. Result type can be: NIL: Map for effect. SET: Return a fresh set containing the mapped elements. LIST: Return a fresh list containing the mapped elements in arbitrary order. (Note that "arbitrary" does not mean "random". See DOSET
-
EXTERNAL FUNCTION NADJOIN
- ITEM
- SET
Return a set with all the elements of SET plus ITEM, destroying SET in the process.
-
EXTERNAL FUNCTION NOTANY
- P
- SET
Return true iff no elements of SET are true under PREDICATE.
-
EXTERNAL FUNCTION NOTEVERY
- P
- SET
Return true iff some element of SET is not true under PREDICATE.
-
EXTERNAL FUNCTION NREMOVE
- ITEM
- SET
Return a set with all the elements of SET sans ITEM, destroying SET in the process.
-
EXTERNAL FUNCTION NSUBTRACT
- MINUEND
- SUBTRAHEND
Return a set containing all elements of MINUEND not in SUBTRAHEND, destroying MINUEND in the process.
-
EXTERNAL FUNCTION NUNION
- S1
- S2
Return the union of S1 and S2. S1 is destroyed. See UNION
-
EXTERNAL FUNCTION PRESENTP
- ITEM
- SET
Check if ITEM is present in SET.
-
EXTERNAL FUNCTION SET-TO-LIST
- SET
Return a fresh list containing the elements of SET in arbitrary order. (Note that "arbitrary" does not mean "random".
-
EXTERNAL FUNCTION SET<=
- SET1
- SET2
Return true iff SET1 is a subset of SET2, i.e. SET2 contains all elements SET1 does.
-
EXTERNAL FUNCTION SET=
- SET1
- SET2
Return true iff SET1 and SET2 contain the same elements.
-
EXTERNAL FUNCTION SIZE
- SET
Return the number of elements in the set.
-
EXTERNAL FUNCTION SOME
- PREDICATE
- SET
Return true iff some element of SET is true under PREDICATE. Note that unlike CL:SOME, this does not necessarily return the result of the predication.
-
EXTERNAL FUNCTION UNION
- S1
- S2
Return the union of S1 and S2.
-
EXTERNAL MACRO DOSET
- VAR
- SETFORM
- &OPTIONAL
- RESULT
- &BODY
- BODY
Map over the elements of SET. Analogous to DOLIST. The order elements are mapped in is undefined. See MAPSET
-
EXTERNAL MACRO NADJOINF
- SET
- ITEM
Set the SET place to a set with the elements of SET plus ITEM, destroying the original set in the process. See NADJOIN
-
EXTERNAL MACRO NREMOVEF
- SET
- ITEM
Set the SET place to a set with the elements of SET sans ITEM, destroying the original set in the process.
-
EXTERNAL MACRO NSUBTRACTF
- MINUEND
- SUBTRAHEND
Set the MINUEND place to be the difference of MINUEND and SUBTRAHEND, destroying MINUEND in the process. See NSUBTRACT
-
EXTERNAL MACRO NUNIONF
- SET
- OTHER
Set the SET place to be the union of SET and OTHER, destroying the original SET in the process. See NUNION
-