From: Tortolo Garcia
Subject: Using List with LISP
Date: 
Message-ID: <3b3637c9$1_1@excalibur.gbmtech.net>
Dear friends, somebody can help me to write a LISP function, which takes a
simple list numbers as single parameter, and returns the maximum value in
the list.

Thanks,


Tortolo Garcia
From: Peter Wood
Subject: Re: Using List with LISP
Date: 
Message-ID: <80ofrdfz79.fsf@localhost.localdomain>
"Tortolo Garcia" <·······@208.243.164.16> writes:

> Dear friends, somebody can help me to write a LISP function, which takes a
> simple list numbers as single parameter, and returns the maximum value in
> the list.

You have max builtin in CL: '(max 1 2 3 4 3 2 1) => 4', so if you
_must_ use a list of numbers you could just say:

(defun maxlist (list)
  (apply #'max list))

(maxlist '(1 2 3 4 3 2 1)) => 4

'course there are lots of other ways.  You should get a decent
reference.  Paul Graham's 'Ansi Common Lisp' is a good
beginner->intermediate book.  And with a sense of humour - there
can't be too many language manuals with a reference to adultery in the
index. :-)

Regards,
Peter