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
"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