Skip to content

Instantly share code, notes, and snippets.

@Licenser
Forked from devn/core.clj
Created April 1, 2010 16:04
Show Gist options
  • Save Licenser/351991 to your computer and use it in GitHub Desktop.
Save Licenser/351991 to your computer and use it in GitHub Desktop.
(defn truncate [t coll]
(map (fn [ct]
(if (>= (count ct) t)
(apply str (take t ct) "...")
ct)) coll))
(defn walton*
[#^String s t m?]
(let [result (walton-doc s)]
(if (>= m? 1)
(take m? (map (partial truncate t) result))
(let [random-result (nth result (rand-int (count result)))]
(truncate random-result)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment