test-check

flowthing 2018-05-24T05:38:57.000221Z

Is there a better way to write this?

(gen/fmap (partial reduce merge)
                          (gen/vector
                            (gen/let [id gen/uuid
                                      x  (gen/hash-map :name gen/string)]
                              {id (assoc x :id id)})))
That is, generate maps where the key is the same as the :id in the map in the value. That works fine and doesn't seem too bad to me — just wondering.

2018-05-24T10:38:03.000308Z

if it were me I would be using plumbing and so I'd have this function around to make it slightly cleaner: https://github.com/plumatic/plumbing/blob/6d713472f7324344545aa93597cb2a137b3404b3/src/plumbing/core.cljx#L91

2018-05-24T10:39:01.000053Z

so it becomes (gen/fmap #(map-from-vals :id %) (gen/vector gen-a-map-with-an-id))

2018-05-24T10:41:51.000261Z

which I guess means it also seems natural to me to pull out the map generator and give it a name