Finding the maximum in a list



Am 10 May 2006 um 22:36 hat Neilen Marais geschrieben:

> Hi
> 
> I'm trying to find the largest item in a list. I.e. [5,3,7,2] -> 7.
> 
> It seems the max() routine doesn't work on lists, but expects you to
> pass
> the items in individually.  Is 
> 
> lreduce(max, [5,3,7,2]);
> 
> the best way to achieve this?
> 
> Thanks
> Neilen
> 

Hi Neilen,

just enter  apply(max, [5,3,7,2]);

The function apply does what you want.

Volker