(ns delirium.core (:gen-class))
(defn delirium [x]
(let [splitter #"[\s \r\n\t,\.\~\!\@\#\$\%\^\&\*\(\)\–\-\_\=\+\\\|\{\}\[\]\"\'\;\:\/\<\>«»]+"
dim (-> x .toLowerCase (clojure.string/split splitter) shuffle)]
(loop [inp dim out []]
(let [edge (+ 4 (rand-int 8))
len (count inp)
[_head _tail] (if (< edge len)
[(subvec inp 0 edge) (subvec inp edge len)]
[inp []])
_out (conj out (str (clojure.string/capitalize (clojure.string/join " " _head)) "."))]
(if (pos? (count _tail))
(recur _tail _out)
(clojure.string/join " " _out))
))
))
(defn -main []
(println "Enter the text:")
(-> System/in slurp delirium println))
(-main)