Created
December 2, 2015 20:52
-
-
Save bryanwoods/d09c38ea0585c0526c37 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
(use '[clojure.string :only (replace-first)]) | |
(def body (atom (slurp "disintegration.txt"))) | |
(def spaces #{\space \newline}) | |
(defn strip-spaces [s] (remove #(spaces %) s)) | |
(defn random-char [s] (rand-nth (strip-spaces s))) | |
(defn delete-random-char [s] | |
(replace-first s (random-char s) \space)) | |
(dotimes [n (.length (apply str (strip-spaces @body)))] | |
(println (swap! body #(delete-random-char %)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment