(ns lab.acentos) (def equivs [[\a \á \ã \â \à] [\e \é \ê] [\i \í] [\o \ó \õ \ô] [\u \ú] [\c \ç]]) (defn gen-rels "Generate relations based on a equivalence table." [table] (mapcat #(mapcat (fn [e] (vector e (first %))) %) table)) (def rels (apply hash-map (gen-rels equivs))) (defn remove-accents "Create a copy of word without accents." [word] (->> word (map #(or (get rels %) %) ) (apply str )))