Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(ns reemvoweler.sync)
(defn build-sentence [orig-tree tree words chars consonants vowels]
(lazy-seq
(if tree
(concat
(if-let [[c & consonants] (seq consonants)]
(build-sentence orig-tree (get tree c) words (conj chars c) consonants vowels))
(if-let [[v & vowels] (seq vowels)]
(build-sentence orig-tree (get tree v) words (conj chars v) consonants vowels))
(if (:word tree)
(let [word (apply str chars)
words (conj words word)]
(if (every? empty? [consonants vowels])
[words]
(build-sentence orig-tree orig-tree words [] consonants vowels))))))))
(defn all-results [tree consonants vowels]
(map (partial clojure.string/join " ")
(build-sentence tree tree [] [] consonants vowels)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.