Minimum & Maximum
	
	
	
	
I'm in need of a function that accepts objects
containing reals and/or ints, and returns
minimums/maximums of each element such that:
if a={5.2,3.4,   7,  55,24} and
   b={  6,  2,12.7,15.9, 5}
then maximum(a,b) should return
     {6.2,3.4,12.7,  55,24}
Obviously, you cannot simply do:
if a<b then return a else return b end if
since that only does atoms.
So, my best solutions thus far, that are safe, are:
-------------------------
function minimum(object a, object b)
object z
integer len
   if atom(a) and atom(b) then
        if a<b then return a else return b end if
   else
        len = length(a)
        if len != length(b) then
          --print an error, the objects, and abort
          Error("Unmatched objects passed to minimum.",a,b)
        end if
        z = repeat(0,len)
        for i = 1 to len do
           z[i] = minimum(a,b)
        end for
   end if
   return z
end function
-----------------------------
with, naturally, function maximum being the opposite of above.
Certainly, there is an easier, faster, more sequence
all-at-once approach? (I'd swear I saw one in the listserv,
but I looked and didn't see it...)
I had thought of the find(1,{expression}) trick, but
I couldn't think of a way to actually make that work
like it would need to.
*hoping that today's brain-fart he's having doesn't offend*
--Hawke'
	
	
		| 
									Not Categorized, Please Help
						 |  |