Last active
August 29, 2015 14:21
-
-
Save d11wtq/81987ad3975f9fffb41d to your computer and use it in GitHub Desktop.
Atbash Cipher in Clojure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns atbash.core | |
(require [clojure.string :refer [join lower-case]])) | |
(def lookup | |
(let [alphabet "abcdefghijklmnopqrstuvwxyz"] | |
(zipmap alphabet (reverse alphabet)))) | |
(defn encode | |
[s] | |
(->> (lower-case s) | |
(map lookup) | |
(filter identity) | |
(partition 5 5 ()) | |
(map join) | |
(join " "))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment