Skip to content

Instantly share code, notes, and snippets.

@d11wtq
Last active August 29, 2015 14:21
Show Gist options
  • Save d11wtq/81987ad3975f9fffb41d to your computer and use it in GitHub Desktop.
Save d11wtq/81987ad3975f9fffb41d to your computer and use it in GitHub Desktop.
Atbash Cipher in Clojure
(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