I have an arbitrary number of lists which I would like to process using the for macro. I want to create a function that passes a vector as the binding since the number of lists
Here is a method of last resort. Be warned, wherever you see read-string
that is code for Here Be Dragons! (Due to security risks, and lack of compile-time consistency guarantees about the behaviour of your code)
(def list1 '("pink" "green"))
(def list2 '("dog" "cat"))
(for [A list1 B list2] (str A "-" B))
(def testvector (vec (list 'A list1 'B list2)))
(def testvector-vec (vec (list 'A (vec list1) 'B (vec list2))))
(def for-string (str "(for " testvector-vec "(str A \"-\" B))"))
(eval (read-string for-string))
> ("pink-dog" "pink-cat" "green-dog" "green-cat")