I want to write a generator that zipmaps values in coll-a to values in coll-b, but with the restriction that each entry in coll-a will be present in keys of the resulting map. Is this possible?
I've got something like this
(let [a [1 2 3]
b [:foo :bar]]
(gen/fmap (partial apply zipmap)
(gen/tuple
(gen/shuffle a)
(gen/return (cycle b)))))
not sure if there is a better way to do it
how about (let [a [1 2 3], b [:foo :bar]] (gen/let [vals (gen/vector (gen/elements b) (count a))] (zipmap a vals)))
@danstone
Thats great - thanks @gfredericks
np