September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -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"

View file

@ -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!"