pythonify.clj
Pinchord · pinchord.git · Tickets · Changelog
Branches > main > 519000d > files / pythonify.clj
(defn stringifyify [x]
(str \" (name x) \"))
(defn pythonify [x]
(cond
(map? x) (str "{"
(str/join ",\n"
(map (fn [[k v]]
(str (stringifyify k) ": " (pythonify v)))
x))
"}")
(string? x) (stringifyify x)
:else (str x)))
; "prefixes": {
; "+": "{^}",
; "#": "{-|}",
; "#+": "{^}{-|}",
; "": "{}",
; },
(def plover-prefixes {"+" "{^}"
"#" "{-|}"
"#+" "{^}{-|}"
"" "{}"})
(defn slurpandshit []
(update (assoc (select-keys (edn/read-string (slurp "chords.edn"))
[:initials :vowels :finals :suffixes])
:prefixes plover-prefixes)
:initials dissoc ""))
(comment
(spit "pythontest.py" (pythonify (slurpandshit))))