September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,12 +0,0 @@
|
|||
(defn rot-13 [c]
|
||||
(let [i (int c)]
|
||||
(cond
|
||||
(or (and (>= i (int \a)) (<= i (int \m)))
|
||||
(and (>= i (int \A)) (<= i (int \M))))
|
||||
(char (+ i 13))
|
||||
(or (and (>= i (int \n)) (<= i (int \z)))
|
||||
(and (>= i (int \N)) (<= i (int \Z))))
|
||||
(char (- i 13))
|
||||
:else c)))
|
||||
|
||||
(apply str (map rot-13 "abcxyzABCXYZ")) ;; output "nopklmNOPKLM"
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
(let [A (into #{} "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
A-map (zipmap A (take 52 (drop 26 (cycle A))))]
|
||||
|
||||
(defn rot13[in-str]
|
||||
(reduce str (map #(if (A %1) (A-map %1) %1) in-str))))
|
||||
|
||||
(rot13 "The Quick Brown Fox Jumped Over The Lazy Dog!") ;; produces "Gur Dhvpx Oebja Sbk Whzcrq Bire Gur Ynml Qbt!"
|
||||
Loading…
Add table
Add a link
Reference in a new issue