kth-smallest ( seq k -- elt )
Statistics

Prev:minmax ( seq -- min max )
Next:Computing histograms


Vocabulary
math.statistics

Inputs
seqa sequence
kan integer


Outputs
eltan object


Word description
Returns the kth smallest element. This is semantically equivalent to swap natural-sort nth, and is therefore zero-indexed. k may not be larger than the highest index of sequence.

Examples
USING: math.statistics prettyprint ; { 3 1 2 } 1 kth-smallest .
2


Definition