0.0.12 permalink Arrow_down_16x16

collection-generator

circumspec.for-all

  • (collection-generator sym coll)
Create var sym* pointing to the collection, and var
sym pointing to a fn that returns a random element
from the collection.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source circumspec/for_all.clj:41 top

(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)))))
Vars in circumspec.for-all/collection-generator: defmacro let apply concat defn list rand-nth seq vector
Used in 0 other vars

Comments top

No comments for collection-generator. Log in to add a comment.