2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,13 +1,9 @@
(defun encipher-char (ch key)
(let*
((c (char-code ch))
(la (char-code #\a)) (lz (char-code #\z))
(ua (char-code #\A)) (uz (char-code #\Z))
(base (cond
((and (>= c la) (<= c lz)) la)
((and (>= c ua) (<= c uz)) ua)
(t nil))))
(if base (code-char (+ (mod (+ (- c base) key) 26) base)) ch)))
(let* ((c (char-code ch)) (la (char-code #\a)) (ua (char-code #\A))
(base (cond ((<= la c (char-code #\z)) la)
((<= ua c (char-code #\Z)) ua)
(nil))))
(if base (code-char (+ (mod (+ (- c base) key) 26) base)) ch)))
(defun caesar-cipher (str key)
(map 'string #'(lambda (c) (encipher-char c key)) str))