Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Improve my shitcode [Clojure]

Name: Anonymous 2016-06-03 0:14

This makes a square shape of text as such:

Y o u h a v e b e e n t r o l l e d
o e
u l
l
h o
a r
v t
e
n
b e
e e
e b
n
e
t v
r a
o h
l
l u
e o
d e l l o r t n e e b e v a h u o Y


(require '[clojure.string :as s])

(defn square-text
[text]
(let [backwards (s/reverse text)
space (s/join (repeat (- (* 2 (count text)) 3) " "))
spaceify (fn [str] (s/join (interpose " "
(s/split str
(re-pattern "")))))]
(do (prn (spaceify text))
(loop [f (subs text 1 (- (count text) 1))
b (subs backwards 1 (- (count backwards) 1))]
(when-not (empty? f)
(prn (str (first f) space (first b)))
(recur (subs f 1) (subs b 1))))
(prn (spaceify backwards)))))

Name: Anonymous 2016-06-03 4:48

Clojure is not a lisp
Javashit is a lisp

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List