wiki:BigIdeas/Collections

Collections

Collection is an abstract category, similar to a group of a zero, one or more items or members. The fundamental notion is that a collection is organized somehow, while a group is a pure abstraction.

There are more general and specialized collections. The most generic collection could be defined as something Traversable, while more specialized collection could be something Iterable.

The crucial point is that in this abstract reasoning an empty collection - a collection which zero elements (with nothing inside) - is a valid collection and every function which implements a collection [wuki:/BigIdeas/AbstractDataType ADT] must handle this fundamental invariant.

The second point is that a single element is also a collection - there is no principal difference how many elements a collection could contain - zero, one or more.

The implication is that one could map, filter, foldr or flatten an empty collection, or a single element.

Ordered

Ordered collections imply a certain ordering which is crucial for any communication. The actual transmission could be (and must be assumed to be) out-of-order, while interpretation of messages received requires a certain order.

The notion of ordering corresponds to molecular structures. A pair of atoms implies an ordering, which is the same in symmetrical compositions.

Notice, that actual molecules "knows nothing" about any ordering whatsoever. The machinery of molecular biology uses exact pattern-matching on concrete structures.

Traversable

  • Foldable

Iterable

Sortable

  • Reversible

Last modified 2 years ago Last modified on Dec 19, 2017, 10:01:15 AM
Note: See TracWiki for help on using the wiki.