If I have two arguments [[1 2] [3 4]] and [5 6], how can I get to [[1 5] [2 6] [3 5] [4 6]].
I thought I may have to use for
so I tried,
(fo
If I understood your question correctly, your solution is actually very close. You did not need to nest the for
expressions explicitly, since doing so creates a new list at every level, instead, just use multiple bindings:
(for [x [[1 2][3 4]]
xx x
y [5 6]]
[xx y])
Which will result in
([1 5] [1 6] [2 5] [2 6] [3 5] [3 6] [4 5] [4 6])
Now that I finally read your question carefully, I came up with the same answer as @Lee did (mapcat (fn[x] (map vector x [5 6])) [[1 2] [3 4]])
, which is the right one and should probably be accepted.