1

I want to find the max element in a list of numbers.

(setq l (list 1 2 3 4 5))

What is an easy way to call the max function on l? So far I have this but this seems convoluted:

(eval `(max ,@l))

It seems like there should be an easier way. No?

Drew
  • 75,699
  • 9
  • 109
  • 225
jds
  • 177
  • 7

1 Answers1

3

Function apply is what you're looking for:


(apply #'max l)
Drew
  • 75,699
  • 9
  • 109
  • 225