sort.sort-by-value

function

Library: Sorting (OMSORT)
Import : omsort.xmd

Declaration
export overloaded function 
   sort-by-value modifiable integer shelf-to-sort
or
export overloaded function 
   sort-by-value modifiable stream shelf-to-short
or
export overloaded function 
   sort-by-value modifiable string shelf-to-short

Argument definitions

shelf-to-sort
is a shelf of integers, streams, or strings


Purpose

Use sort.sort-by-value to sort shelf-to-sort according to its values in ascending order. shelf-to-sort can have type integer, stream, or string.

Requirements

If shelf-to-sort is a stream shelf, then it must

Example

The following example sorts a list of string values:

  import "omsort.xmd" prefixed by sort.
  
  process
     local string string-test-shelf variable initial { "foo", "bar", "sna" }
  
     sort.sort-by-value string-test-shelf
     
     repeat over string-test-shelf
        output string-test-shelf || "%n"
     again

Other Library Functions