Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Clojure Dojo Tuesday, August 28, 2012
(ns dojo.core
(use clojure.string))
(def *input*
" _ _ _ _ _ _ _
| _| _||_||_ |_ ||_||_|
||_ _| | _||_| ||_| _|")
(def *zeros*
" _ _ _ _ _ _ _ _ _
| || || || || || || || || |
|_||_||_||_||_||_||_||_||_|")
(def *dic*
{
'(\space \_ \space \| \space \| \| \_ \|) 0
'(\space \space \space \space \space \| \space \space \|) 1
'(\space \_ \space \space \_ \| \| \_ \space) 2
'(\space \_ \space \space \_ \| \space \_ \|) 3
'(\space \space \space \| \_ \| \space \space \|) 4
'(\space \_ \space \| \_ \space \space \_ \|) 5
'(\space \_ \space \| \_ \space \| \_ \|) 6
'(\space \_ \space \space \space \| \space \space \|) 7
'(\space \_ \space \| \_ \| \| \_ \|) 8
'(\space \_ \space \| \_ \| \space \_ \|) 9
})
(defn break-to-9 [s]
(map #(partition 3 %) (split s #"\n")))
(defn conv [e]
(if (empty? (flatten e))
nil
(concat
(map first e)
(conv
(map rest e)))))
(defn proc-str [s]
(map #(get *dic* %) (map flatten (partition 3 (conv (break-to-9 s))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.