Re: map over a Map with conditional conj

2015-08-25 Thread Sven Richter
Hi Moe, Thanks, i didn't know about :when and :let in for. That is my favorite so far, small and readable, looks good. Sven Am Dienstag, 25. August 2015 11:17:23 UTC+2 schrieb Moe Aboulkheir: > > Sven, > > To me, the keep version would be a lot more readable if it were creating a > literal map

Re: map over a Map with conditional conj

2015-08-25 Thread Moe Aboulkheir
Sven, To me, the keep version would be a lot more readable if it were creating a literal map in a fn. I think (for) is almost always the right thing. It's not as fun to write, but much easier to read: (for [i (range 1 11) :let [id (keyword (str "answer_correct_" i))] :when (params i

map over a Map with conditional conj

2015-08-25 Thread Sven Richter
Hi, I find myself repeating a certain pattern from time to time. I have a map like this: {:answer_correct_1 2 :answer_correct_3 4 :foo "bar"} There is a hidden index answer_correct_idx which might range from 1 to x. So, what I want is to "iterate" over the map and produce a vec of maps given s