Functional Mappings

Map values are usually constructed incrementally by assignments to variables of type map. For example:
  m : map from String to Boolean
  m(`Yes') := True
  m(`No') := False
In Mathematics, we could denote the final value of m as follows:
  {(`Yes', True), (`No', False)}
In Slim, however, the use of round brackets to denote elements of Cartesian Products, would complicate the syntax while adding very little to the power of the language. Consequently, there is no way to denote map values directly. Instead, the predefined function mkmap can be used to convert a set of lists into a map value. For example:
  m := mkmap({[`yes' true] [`no' false]})
The set of lists notation is also used by the put instruction. It is also possible to convert a map back into a set of lists, using the indexed function.

All map values belong to the predefined type Map.

See also: Function defintion.


Herman Venter

This is Slim documentation as snarfed on 27 May 1999 by dB.