Set (abstract Data Type) - Language Support

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 Set interface to support sets (with the HashSet class implementing it using a hash table), and the SortedSet sub-interface to support sorted sets (with the TreeSet class implementing it using a binary search tree).
  • Apple's Foundation framework (part of Cocoa) provides the Objective-C classes NSSet, NSMutableSet, NSCountedSet, NSOrderedSet, and NSMutableOrderedSet. The CoreFoundation APIs provide the CFSet and CFMutableSet types for use in C.
  • Python has built-in set and frozenset types 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 HashSet and SortedSet classes that implement the generic ISet interface.
  • Smalltalk's class library includes Set and IdentitySet, 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 set module which contains Set and SortedSet classes that implement sets using hash tables, the latter allowing iteration in sorted order.
  • OCaml's standard library contains a Set module, which implements a functional set data structure using binary search trees.
  • The GHC implementation of Haskell provides a Data.Set module, 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:

    This is of the loon—I do not mean its laugh, but its looning,—is a long-drawn call, as it were, sometimes singularly human to my ear,—hoo-hoo-ooooo, like the hallooing of a man on a very high key, having thrown his voice into his head. I have heard a sound exactly like it when breathing heavily through my own nostrils, half awake at ten at night, suggesting my affinity to the loon; as if its language were but a dialect of my own, after all.
    Henry David Thoreau (1817–1862)

    Because the young child feels with such intensity, he experiences sorrows that seem inconsolable and losses that feel unbearable. A precious toy gets broken or a good-bye cannot be endured. When this happens, words like “sad” or “disappointed” seem a travesty because they cannot possibly capture the enormity of the child’s loss. He needs a loving adult presence to support him in his pain but he does not want to be talked out of it.
    Alicia F. Lieberman (20th century)