Repository navigation
Modern Set ExceptWith
Paul Squires edited this page Oct 19, 2026
·
5 revisions
Removes every value that is also in another set.
ExceptWith( byref other as Set( of T ) )- Modifies the receiver.
otheris left untouched. - The set difference: what is left is in this set and not in
other. - Removing
other's elements one at a time is O(|other|), which beats scanning this set whenotheris the smaller side.
#import "std/containers"
using containers
dim a as Set( of integer )
dim b as Set( of integer )
for i as integer = 1 to 5 : a.Add( i ) : next '' { 1, 2, 3, 4, 5 }
for i as integer = 4 to 9 : b.Add( i ) : next '' { 4, 5, 6, 7, 8, 9 }
a.ExceptWith( b )
print a.Count '' 3 -- { 1, 2, 3 }
print b.Count '' 6 -- `other` is left alone
'' Elements of `other` that were never in the set are simply not there
'' to remove -- no error, no effecttiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing