Minimum of

angerangel edited this page Jan 4, 2013 · 1 revision
Clone this wiki locally

USAGE

   MINIMUM-OF series /skip size

DESCRIPTION

Finds the smallest value in a series

MINIMUM-OF is a function value.

ARGUMENTS

  • series -- Series to search (series!)

REFINEMENTS

  • /skip -- Treat the series as records of fixed size
    • size (integer!)

#SOURCE

minimum-of: make function! [  [
    "Finds the smallest value in a series"
    series [series!] "Series to search"
    /skip "Treat the series as records of fixed size"
    size [integer!]
    /local spot
][
    size: any [size 1]
    if 1 > size [cause-error 'script 'out-of-range size]
    spot: series
    forskip series size [
        if lesser? first series first spot [spot: series]
    ]
    spot
] ]