Syntax

	$cmp.desc()

Description

Reverses the order of the elements of a list coming from the comparison function cmp.

The following applies: compare(desc($cmp1), desc($cmp2)) = -compare($cmp1,$cmp2). Care must be taken that desc(....) values are only compared with other desc(...) values of comparable content.

See also Comparative value.

Parameter

Name Type Description Mandatory Default
cmp Set The result of a Comparison function. yes

Return value

type: Set

The result of the comparison function cmp in reverse order.

Examples

Sort numbers in descending order

	list(5, 8, 2, 6).sort(desc(x -> y -> compare($x, $y))).toString()

Output: A set with the numbers [8, 6, 5, 2].