Common Lisp Package: FSET-USER

README:

FUNCTION

Private

EVERY (PRED SEQUENCE0 &REST MORE-SEQUENCES)

FSet generic version of `cl:every'.

NOTANY (PRED SEQUENCE0 &REST MORE-SEQUENCES)

FSet generic version of `cl:notany'.

NOTEVERY (PRED SEQUENCE0 &REST MORE-SEQUENCES)

FSet generic version of `cl:notevery'.

SOME (PRED SEQUENCE0 &REST MORE-SEQUENCES)

FSet generic version of `cl:some'.

MACRO

Private

COND (&REST CLAUSES)

A generalization of CL:COND that makes it convenient to compute a value in the predicate expression of a clause and then use that value in the consequent. If the predicate expression is a LET form, then the scope of the variables bound by the LET is extended to include the consequent expressions. For example: (cond ((let ((x (foo))) (bar x)) (baz x))) Here the X in (BAZ X) is the one bound to the result of (FOO).

LET (CLAUSES &BODY BODY)

A generalization of CL:LET that better supports nested bindings and multiple values. Syntax: (let (<clause>*) <body>). The <clause> syntax is more general than for CL:LET: <clause> ::= <symbol> ; binds to NIL | ( <symbol> ) ; likewise | <clause1> <clause1> ::= ( <symbol>+ <form> ) ; binding | ( <clause1>+ ) ; nesting When a clause begins with more than one variable name, they are to be bound to successive values of the form. The nesting of clauses indicates sequencing of bindings; more deeply nested clauses may reference bindings of shallower clauses. All bindings at a given depth are done in parallel. This allows arbitrary combinations of parallel and sequential binding. Standard declarations at the head of BODY are handled correctly, though nonstandard ones may not be. If two variables of the same name are bound at different levels, any declaration applies to the inner one.

MAP (&REST ARGS)

Constructs a map of the default implementation according to the supplied argument subforms. Each argument subform can be a list of the form (`key-expr' `value-expr'), denoting a mapping from the value of `key-expr' to the value of `value-expr'; or a list of the form ($ `expression'), in which case the expression must evaluate to a map, denoting all its mappings; or the symbol `:default', in which case the next argument subform is a form whose value will become the map's default. The result is constructed from the denoted mappings in left-to-right order; so if a given key is supplied by more than one argument subform, its associated value will be given by the rightmost such subform.

SET (&REST ARGS)

Constructs a set of the default implementation according to the supplied argument subforms. Each argument subform can be an expression, whose value will be a member of the result set; or a list of the form ($ `expression'), in which case the expression must evaluate to a set, all of whose members become members of the result set.

GENERIC-FUNCTION

Private

COMPLEMENT (SET)

Returns the complement of the set.

COUNT (ITEM COLLECTION &KEY KEY TEST FROM-END END START TEST-NOT)

If `collection' is a Lisp sequence, this simply calls `cl:count'. On an FSet collection, the default for `test' is `equal?'; the `:test-not' keyword is not accepted; and the `:start', `:end', and `:from-end' keywords are accepted only if `collection' is a seq. Also, on a map, this scans the domain.

COUNT-IF (PRED COLLECTION &KEY KEY FROM-END END START)

If `collection' is a Lisp sequence, this simply calls `cl:count-if'. On an FSet collection, the `:start', `:end', and `:from-end' keywords are accepted only if `collection' is a seq. Also, on a map, this scans the domain.

COUNT-IF-NOT (PRED COLLECTION &KEY KEY FROM-END END START)

If `collection' is a Lisp sequence, this simply calls `cl:count-if-not'. On an FSet collection, the `:start', `:end', and `:from-end' keywords are accepted only if `collection' is a seq. Also, on a map, this scans the domain.

FIND (ITEM COLLECTION &KEY KEY TEST FROM-END END START TEST-NOT)

If `collection' is a Lisp sequence, this simply calls `cl:find'. On an FSet collection, the default for `test' is `equal?'; the `:test-not' keyword is not accepted; and the `:start', `:end', and `:from-end' keywords are accepted only if `collection' is a seq. Also, on a map, this scans the domain; on success, it returns the corresponding range element as the second value.

FIND-IF (PRED COLLECTION &KEY KEY FROM-END END START)

If `collection' is a Lisp sequence, this simply calls `cl:find-if'. On an FSet collection, the `:start', `:end', and `:from-end' keywords are accepted only if `collection' is a seq. Also, on a map, this scans the domain; on success, it returns the corresponding range element as the second value.

FIND-IF-NOT (PRED COLLECTION &KEY KEY FROM-END END START)

If `collection' is a Lisp sequence, this simply calls `cl:find-if-not'. On an FSet collection, the `:start', `:end', and `:from-end' keywords are accepted only if `collection' is a seq. Also, on a map, this scans the domain; on success, it returns the corresponding range element as the second value.

FIRST (SEQ)

Returns the first element of `seq', i.e., element 0. This has a back- compatibility method for lists, and adds one for CL sequences generally.

INTERSECTION (SET-OR-BAG1 SET-OR-BAG2 &KEY TEST TEST-NOT)

Returns the intersection of the two sets/bags. The result is a bag if both arguments are bags; otherwise a set. The intersection of two bags is the bag whose multiplicity, for any value, is the minimum of its multiplicities in the two argument bags.

LAST (SEQ)

Returns the last element of `seq', i.e., element `(1- (size seq))'. This has methods for CL lists and sequences that are NOT COMPATIBLE with `cl:last'. FSet exports `lastcons' as an arguably better name for the functionality of `cl:last'.

POSITION (ITEM COLLECTION &KEY KEY TEST START END FROM-END TEST-NOT)

If `collection' is a Lisp sequence, this simply calls `cl:position'. On an FSet seq, the default for `test' is `equal?', and the `:test-not' keyword is not accepted.

POSITION-IF (PRED COLLECTION &KEY KEY START END FROM-END)

If `collection' is a Lisp sequence, this simply calls `cl:position-if'. Also works on an FSet seq.

POSITION-IF-NOT (PRED COLLECTION &KEY KEY START END FROM-END)

If `collection' is a Lisp sequence, this simply calls `cl:position-if-not'. Also works on an FSet seq.

REDUCE (FN COLLECTION &KEY KEY INITIAL-VALUE FROM-END END START)

If `collection' is a Lisp sequence, this simply calls `cl:reduce' (q.v.). On an FSet collection, the `:start', `:end', and `:from-end' keywords are accepted only if `collection' is a seq.

REMOVE (ITEM COLLECTION &KEY KEY TEST COUNT FROM-END END START)

If `collection' is a Lisp sequence, this simply calls `cl:remove'. On an FSet seq, the default for `test' is `equal?', and the `:test-not' keyword is not accepted.

REMOVE-IF (PRED COLLECTION &KEY KEY COUNT FROM-END END START)

If `collection' is a Lisp sequence, this simply calls `cl:remove-if'. Also works on an FSet seq; but see `filter'.

REMOVE-IF-NOT (PRED COLLECTION &KEY KEY COUNT FROM-END END START)

If `collection' is a Lisp sequence, this simply calls `cl:remove-if-not'. Also works on an FSet seq; but see `filter'.

REVERSE (SEQ)

Returns `seq' in reverse order.

SET-DIFFERENCE (SET1 SET2 &KEY TEST TEST-NOT)

Returns the set difference of set1 and set2, i.e., the set containing every member of `set1' that is not in `set2'.

SORT (SEQ PRED &KEY KEY)

Returns `seq' sorted by `pred', a function of two arguments; if `key' is supplied, it is a function of one argument that is applied to the elements of `seq' before they are passed to `pred'. The sort is not guaranteed to be stable. The method for CL sequences copies the sequence first, unlike `cl:sort'.

STABLE-SORT (SEQ PRED &KEY KEY)

Returns `seq' sorted by `pred', a function of two arguments; if `key' is supplied, it is a function of one argument that is applied to the elements of `seq' before they are passed to `pred'. The sort is guaranteed to be stable. The method for CL sequences copies the sequence first, unlike `cl:stable-sort'.

SUBSEQ (SEQ START &OPTIONAL END)

Returns the subsequence of `seq' from `start' (inclusive) to `end' (exclusive), where `end' defaults to `(size seq)'.

SUBSTITUTE (NEWITEM OLDITEM COLLECTION &KEY KEY COUNT FROM-END END START TEST)

If `collection' is a Lisp sequence, this simply calls `cl:substitute'. On an FSet seq, the default for `test' is `equal?', and the `:test-not' keyword is not accepted.

SUBSTITUTE-IF (NEWITEM PRED COLLECTION &KEY KEY COUNT FROM-END END START)

If `collection' is a Lisp sequence, this simply calls `cl:substitute-if'. Also works on an FSet seq.

SUBSTITUTE-IF-NOT (NEWITEM PRED COLLECTION &KEY KEY COUNT FROM-END END START)

If `collection' is a Lisp sequence, this simply calls `cl:substitute-if-not'. Also works on an FSet seq.

UNION (SET-OR-BAG1 SET-OR-BAG2 &KEY TEST TEST-NOT)

Returns the union of the two sets/bags. The result is a set if both arguments are sets; otherwise a bag. The union of two bags is a bag whose multiplicity, for any value, is the maximum of its multiplicities in the two argument bags.

CLASS

Private

MAP (&REST ARGS)

The abstract class for FSet functional maps. It is a structure class.

SET (&REST ARGS)

The abstract class for FSet functional sets. It is a structure class.