Skip to content

Instantly share code, notes, and snippets.

Created July 20, 2014 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d466e39235df87d6d49f to your computer and use it in GitHub Desktop.
Save anonymous/d466e39235df87d6d49f to your computer and use it in GitHub Desktop.
(defn build-words [chain]
(let [[word next-words] (rand-nth (seq chain))
next-word (rand-nth next-words)]
(loop [words [word next-word]]
(let [next-words (get chain (last words))]
(if (nil? next-words)
words
(recur (conj words (rand-nth next-words))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment