I am a newbie and making some exercises. How can I put a def
with a list of sentences and a randomizer function inside a defn
function? How does that work?
(def list["test1", "test2", "test3"])
- works fine
(rand-nth list)
- works fine
How do I put it inside a function defn
?
Thanks for help.
IIUC you just want to reimplement
rand-nth
, no?If you want the list to be static (non-changing)
works, but it creates the vector upon each call, a better way is to