The Grinnell Scheme Web: The min procedure

How do I find the least of a group of numbers?

Call the min procedure, giving it all of the numbers as operands:

> (min 37 41)
37
> (min -83 -17 -218 -62 -718)
-718
> (min 12)
12
> (min -14 -14 -14 3 -14 -12 -14 -5 -14)
-14
Do the operands have to be integers?

No, any or all of them can be rationals or reals, if the implementation supports such numbers. The min procedure cannot accept complex numbers as operands, however, since they are not uniquely ordered as ``less'' and ``greater.''

Can the min procedure receive any number of operands?

Any number except zero. It makes no sense to try to find the least of an empty collection of numbers.


Next topic
Previous topic
Table of contents


This document is available on the World Wide Web as

http://www.math.grin.edu/~stone/scheme-web/min.html


created June 24, 1995
last revised December 29, 1995

Copyright 1995 by John David Stone (stone@math.grin.edu)