Create var sym* pointing to the collection, and var
sym pointing to a fn that returns a random element
from the collection.
(defmacro collection-generator
"Create var sym* pointing to the collection, and var
sym pointing to a fn that returns a random element
from the collection."
[sym coll]
(let [data-name (data-name-for-generator-coll sym)]
`(do
(def ~data-name ~coll)
(defn ~sym [] (rand-nth ~data-name)))))
Comments top
No comments for collection-generator. Log in to add a comment.