Created
April 1, 2010 15:17
-
-
Save devn/351924 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn truncate [coll t] | |
(let [c coll | |
ct (first c) | |
rt (second c)] | |
[(if (>= (count ct) t) | |
(apply str (take t ct) "...") | |
ct) | |
(if (>= (count rt) t) | |
(apply str (take t rt) "...") | |
rt)])) | |
(defn walton* | |
[#^String s t m?] | |
(let [result (walton-doc s)] | |
(if (>= m? 1) | |
(take m? (map #(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