Вопрос

So I have written this function that returns a list of numbers in this format:

'(1 2 5 6 7 2)

Now I need to find the maximum value of this list, but the max function doesn't seem to work with this type of list. How would I go about solving this problem?

Это было полезно?

Решение

What you want is

> (max 1 2 5 6 7 2)
7

Since your arguments are in a list, use apply:

> (apply max '(1 2 5 6 7 2))
7

See also here.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top