Im really doing this: (repeatedly n #(rand-nth (seq coll))) , but I suspect there might be a more idiomatic way for two reasons:
- Ive found that theres is often a more concise and expressive alternative to using short anonymous functions, for example.
partial - docstring for
repeatedly says βpresumably with side effects,β meaning it is not intended to be used to create values
I suppose I can find a way to use reduce , but it seems that it would be difficult and less efficient, since I would have to process the entire collection, since reduce not lazy.
source share