I have been playing around with clojure, and decided to make a higher order function that combines mapcat and list to emulate this behavior:
Clojure> (ma
You are looking for apply
. This calls a function with the arguments supplied in a sequence.
But are you aware that there's a function interleave
that does exactly what your mapcatList
tries to do?
You're right, the arguments are wrapped in a list as a result of the vararg declaration. You need to apply
the arguments in order to unwrap the list of arguments:
(defn mapcatList[& more]
(apply mapcat list more))
user=> (mapcatList '(1 2 3 4) '(5 6 7 8))
(1 5 2 6 3 7 4 8)
user=> (mapcatList '(1 2 3 4) '(5 6 7 8) '(\a \b \c \d))
(1 5 \a 2 6 \b 3 7 \c 4 8 \d)