Pack

Syntax

	$expr.singleton()

Description

Packs the result of expr into a one-element set. A non null value results in a set of size one with this value as the only element, even if expr itself is a set. A null value results in the empty set.

See also Unpack.

Parameter

Name Type Description Mandatory Default
expr Number/string/boolean/business object/set An expression whose evaluation is to be wrapped in a one-element set. yes

Return value

Type: Set

A set with one element representing the result of expr. An empty set if null is used for expr.

Examples

Wrapping an element

	singleton(5)

Output: A set with the contents [5].

Wrapping null

	singleton(null)

Output: An empty set.

Packing a list

	singleton(list(1, 2, 2))

Output: A set with the content [1; 2; 2], where it is only one element.