Skip to content
bergsma edited this page Sep 26, 2014 · 5 revisions

#sort

###Sort the elements of a list variable.

Syntax

status = sort variable ;

Arguments

  1. list variable

The list variable to sort. The variable cannot be a vector.

Return Value

str status
  • $ACKNOWLEDGE : The list is sorted.

The STATUS variable is set to $ACKNOWLEDGE

  • %UNDEFINED : Cannot sort non-list variable.

The STATUS variable is set to %UNDEFINED

Warnings

  • %UNDEFINED : Cannot sort non-list variable.

Exceptions

  • %ARGUMENT: Invalid arguments. Usage: status = sort variable ;

  • %IDENTIFIER: 'variable' argument is not a valid identifier, literal, or reference

Description

Sort works on list variables.
It does an item to item comparison based on the datatype of the items.

Examples

list a = { 1,4,6,5,7,8,2,3,9} ;
sort a ;
describe a ;

list elements = {
	"dog",
	"cat",
	list x = {1,2,3},
	100,
	101
} ;
sort elements ;
describe elements ;

reverse elements.x ;
describe elements ;

Related Links

reverse

Clone this wiki locally