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?

1 Answer 1

3

Function apply is what you're looking for:


(apply #'max l)
1
  • Thats exactly what I am looking for! Thank you.
    – jds
    Commented Nov 28, 2021 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.