The set extensions provide operations for working with sets represented as lists of unique elements. These extensions may or may not be present depending on the platform and configuration of LispBM.
member checks if a value is an element of a list. The form of a member expression is (member value list). Returns list if value is found anywhere in it, or nil if not found. Equality is tested structurally in the same way as eq, so number types must match. Note that member is part of core LispBM and is always available.
| Example | Result |
|
|
|
|
|
|
|
|
set-insert inserts a value into a set. Sets are represented as lists with no duplicate elements. The form of a set-insert expression is (set-insert set value). If value is already a member of set the original set is returned unchanged. Otherwise a copy of the set is returned with value appended. Membership is tested using structural equality.
| Example | Result |
|
|
|
|
|
|
set-union computes the union of two sets. Sets are represented as lists with no duplicate elements. The form of a set-union expression is (set-union set1 set2). Returns a set containing all elements from both set1 and set2 with no duplicates. Membership is tested using structural equality.
| Example | Result |
|
|
|
|
|
|
This document was generated by LispBM version 0.36.0