(def all-names ["John" "James" "Jakob" "Peter" "Janette" "Tom" "Vasya" "Jean" "Juilia" "Heather"])
(defn filter-names-by [regexp, names]
"...and returns collection of names."
(filter #(re-matches regexp %) names))
(def matched-names (filter-names-by #"J[a-z]+" all-names))
(defn names->story [names]
"Creates astonishing story from plain names."
(clojure.string/join
"\n"
(for [[first second third]
(partition 3 names)]
(format "%s and %s follow %s" first second third))))
(def story (names->story matched-names))
(print story)
KGRlZiBhbGwtbmFtZXMgWyJKb2huIiAiSmFtZXMiICJKYWtvYiIgIlBldGVyIiAiSmFuZXR0ZSIgIlRvbSIgIlZhc3lhIiAiSmVhbiIgIkp1aWxpYSIgIkhlYXRoZXIiXSkKCihkZWZuIGZpbHRlci1uYW1lcy1ieSBbcmVnZXhwLCBuYW1lc10KICAiLi4uYW5kIHJldHVybnMgY29sbGVjdGlvbiBvZiBuYW1lcy4iCiAgKGZpbHRlciAjKHJlLW1hdGNoZXMgcmVnZXhwICUpIG5hbWVzKSkKCihkZWYgbWF0Y2hlZC1uYW1lcyAoZmlsdGVyLW5hbWVzLWJ5ICMiSlthLXpdKyIgYWxsLW5hbWVzKSkKCihkZWZuIG5hbWVzLT5zdG9yeSBbbmFtZXNdCiAgIkNyZWF0ZXMgYXN0b25pc2hpbmcgc3RvcnkgZnJvbSBwbGFpbiBuYW1lcy4iCiAgKGNsb2p1cmUuc3RyaW5nL2pvaW4gCiAgICAiXG4iIAogICAgKGZvciBbW2ZpcnN0IHNlY29uZCB0aGlyZF0KICAgICAgICAgIChwYXJ0aXRpb24gMyBuYW1lcyldCiAgICAgIChmb3JtYXQgIiVzIGFuZCAlcyBmb2xsb3cgJXMiIGZpcnN0IHNlY29uZCB0aGlyZCkpKSkKCihkZWYgc3RvcnkgKG5hbWVzLT5zdG9yeSBtYXRjaGVkLW5hbWVzKSkKKHByaW50IHN0b3J5KQ==