Previous: count - counting, Up: Value Accumulation [Contents][Index]
maximize expr [into var] [type-spec] maximizing expr [into var] [type-spec] minimize expr [into var] [type-spec] minimizing expr [into var] [type-spec]
var
var
. If there is no ‘into’ variable, the optional ‘type-spec’
argument applies to the internal variable that is keeping the intermediate
result. In either case it is an error to specify a non-numeric data type.
The default type is implementation-dependent, but it must be a subtype of
(or integer float)
.
(loop for i in '(2 1 5 3 4) maximize i)
(loop for i in '(2 1 5 3 4) minimize i)
;;; In this example, FIXNUM applies to the internal ;;; variable that holds the maximum value. (setq series '(1.2 4.3 5.7)) (loop for v in series maximize (round v) fixnum)
;;; In this example, FIXNUM applies to the variable RESULT. (loop for v float in series minimize (round v) into result fixnum finally (return result))
Previous: count - counting, Up: Value Accumulation [Contents][Index]