问题
I am new to Clojure so this question may be trivial:
Suppose you have a list (\h \e \l \l \o) and you want to use it as the actual parameters when calling a function, for example, str in order to get the same result as:
(str \h \e \l \l \o)
I came to a solution using eval:
(def paramlist '(\h \e \l \l \o))
(eval (conj paramlist str))
But I understand that is quite dirty and over killing the problem. What is the best solution to do this?
回答1:
Use apply
user=> (apply str '(1 2 3 4))
"1234"
来源:https://stackoverflow.com/questions/25621696/how-to-use-list-as-parameters