Skip to content

Instantly share code, notes, and snippets.

@devn
Created April 1, 2010 02:21
Show Gist options
  • Save devn/351235 to your computer and use it in GitHub Desktop.
Save devn/351235 to your computer and use it in GitHub Desktop.
(defn walton [#^String s]
(let [count-result (rand-int (count (walton-doc s)))
expr (nth (walton-doc s) count-result)
code-text (first expr)
result-text (second expr)
expr-length (map count (map seq expr))
code-length (first expr-length)
result-length (second expr-length)
truncated-result []]
(if (>= code-length 457)
(conj truncated-result (apply str (take 457 expr) "..."))
(conj truncated-result code-text))
(if (>= result-length 457)
(conj truncated-result (apply str (take 457) "..."))
(conj truncated-result result-text))
truncated-result))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment