Subject: Different max behavior from commercial product.
From: Barton Willis
Date: Sun, 28 Aug 2005 17:50:20 -0500
An nset solution:
(%i1) listmax(s) := if listp(s) or setp(s) then tree_reduce('max, s, 'minf)
else
error("The argument to 'listmax' must be a list or
a set")$
(%i2) listmax([]);
(%o2) minf
Unlike apply('max, list), the listmax function can handle long lists.
(%i3) listmax(makelist(i,i,1,10000));
(%o3) 10000
(%i4) apply('max, makelist(i,i,1,10000));
Maxima encountered a Lisp error: ...
Barton