Subscription Operator

(name | qualified-name) @ [unary-operator] simple-expression

The @ operator corresponds to the use of subcription in Mathematics. The first operand must result in a string, list, map or function. A string, say s, with value `ab' can be regarded as equivalent to this function:

  s(i) = if i = 1 then `a' else if i = 2 then `b' else Undefined
The same applies to lists.

The notation x@y can thus be regarded as short-hand for x(y) which is more natural to use for list and string elements.

See also: slices.


Herman Venter

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