Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@vitorhead
Last active March 19, 2019 14:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitorhead/03f6045d655d3bc32a93c67cdf6cece1 to your computer and use it in GitHub Desktop.
Save vitorhead/03f6045d655d3bc32a93c67cdf6cece1 to your computer and use it in GitHub Desktop.
An attempt to make a runic translator. As soon as you boot it in your repl, enter (setup) to start and you can type whatever you want to translate. When done, enter "exit" to quit the enviroment. The runes were copied from the URL in the gist. No further research has been done.
;https://www.furorteutonicus.eu/germanic/runescribe/index.php
(def runes "ᚨᛒᚲᛞᛖᚠᚷᚺᛇᚲᛚᛗᚾᛟᛈᛩᚱᛋᛏᚢᚡᚹᛪᛃᛋᛎ")
(def alphabet "abcdefghijklmnopqrstuvwxyz")
(def values (zipmap alphabet runes))
(defn is-in?
[elem col]
(some #(= elem %) col))
(defn translate
[s]
(cond
(is-in? s alphabet) (values s)
:else s))
(defn validate
[arg]
(not= "exit" arg))
(defn setup
[]
(println "Runic translation!")
(loop [lines (repeatedly read-line)]
(let [line (first lines)]
(when (validate line)
(println (map translate (clojure.string/lower-case line)))
(recur (next lines))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment