minimum-by ( ... seq quot: ( ... elt -- ... x ) -- ... elt )
Factor handbook » The language » Collections » Sequence operations » Sequence combinators

Prev:minimum ( seq -- elt )
Next:maximum ( seq -- elt )


Vocabulary
sequences

Inputs
seqa sequence
quota quotation


Outputs
eltan object


Word description
Outputs the least element of seq according to the quot.

Examples
Example:
USING: sequences prettyprint ; { { 1 2 } { 1 2 3 } { 1 2 3 4 } } [ length ] minimum-by .
{ 1 2 }


Errors
Throws an error if the sequence is empty.

See also
min, max, minimum, maximum, maximum-by

Definition


: minimum-by
( ... seq quot: ( ... elt -- ... x ) -- ... elt )
[ before? ] select-by ; inline