Sorting a list

In order to sort a list Tcl has provided the lsort command. As with other commands this one accepts numerous options that we will cover prior to discussing the syntax. The options are as follows:

Options

Interpretations

-ascii

Sorts using string comparison with Unicode code-point collation order.

-dictionary

Sorts using dictionary style comparison.

-integer

Converts the list elements to integers and use integer comparison.

-real

Converts the list elements to floating-point values and use floating-point comparison.

-command command

Uses the command provided as a comparison command.

-increasing

Sorts in increasing order.

-decreasing

Sorts in decreasing order.

-indices

Returns a list of indices in ...

Get Tcl/Tk 8.5 Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.