# SML/NJ Library Manual

## The `LIST_SORT` signature

#### Synopsis

> `signature `LIST_SORT`
> structure `ListMergeSort` : LIST_SORT
> `

The LIST_SORT signature specifies an interface for the applicative sorting of lists.

#### Interface

> `val sort : (('a * 'a) -> bool) -> 'a list -> 'a list
> val uniqueSort : (('a * 'a) -> order) -> 'a list -> 'a list
> val sorted : (('a * 'a) -> bool) -> 'a list -> bool
> `

#### Description

`sort f l`
  returns a list of the elements in l, sorted in non-decreasing order as specified by the ``greater than'' predicate f. Specifically, if `f(x,y)` evaluates to true, then `x` will appear after `y` in the resulting list.
`uniqueSort f l`
  returns a list of the elements in l, sorted in increasing order as specified by the comparison function f, and having only one copy of equal elements.
`sorted f l`
  returns true if l is sorted in non-decreasing order as specified by the ``greater than'' predicate f. Specifically, it returns true if for all adjacent items `x,y` in l, `f(x,y)` evaluates to false.

[ Top | Parent | Contents | Index | Root ]

Last Modified June 11, 1998
Comments to John Reppy
Copyright © 1998 Bell Labs, Lucent Technologies