Language Support
One of the earliest languages to support sets was Pascal; many languages now include it, whether in the core language or in a standard library.
- Java offers the
Setinterface to support sets (with theHashSetclass implementing it using a hash table), and theSortedSetsub-interface to support sorted sets (with theTreeSetclass implementing it using a binary search tree). - Apple's Foundation framework (part of Cocoa) provides the Objective-C classes
NSSet,NSMutableSet,NSCountedSet,NSOrderedSet, andNSMutableOrderedSet. The CoreFoundation APIs provide the CFSet and CFMutableSet types for use in C. - Python has built-in
setandfrozensettypes since 2.4, and since Python 3.0 and 2.7, supports non-empty set literals using a curly-bracket syntax, e.g.:{x, y, z}. - The .NET Framework provides the generic
HashSetandSortedSetclasses that implement the genericISetinterface. - Smalltalk's class library includes
SetandIdentitySet, using equality and identity for inclusion test respectively. Many dialects provide variations for compressed storage (NumberSet,CharacterSet), for ordering (OrderedSet,SortedSet, etc.) or for weak references (WeakIdentitySet). - Ruby's standard library includes a
setmodule which containsSetandSortedSetclasses that implement sets using hash tables, the latter allowing iteration in sorted order. - OCaml's standard library contains a
Setmodule, which implements a functional set data structure using binary search trees. - The GHC implementation of Haskell provides a
Data.Setmodule, which implements a functional set data structure using binary search trees. - The Tcl Tcllib package provides a set module which implements a set data structure based upon TCL lists.
As noted in the previous section, in languages which do not directly support sets but do support associative arrays, sets can be emulated using associative arrays, by using the elements as keys, and using a dummy value as the values, which are ignored.
Read more about this topic: Set (abstract Data Type)
Famous quotes containing the words language and/or support:
“We might hypothetically possess ourselves of every technological resource on the North American continent, but as long as our language is inadequate, our vision remains formless, our thinking and feeling are still running in the old cycles, our process may be revolutionary but not transformative.”
—Adrienne Rich (b. 1929)
“At the Carter Center we work with victims of oppression, and we give support to human rights heroes.”
—Jimmy Carter (James Earl Carter, Jr.)