Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Rot-13/ACL2/rot-13.acl2
Normal file
20
Task/Rot-13/ACL2/rot-13.acl2
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
(include-book "arithmetic-3/top" :dir :system)
|
||||
|
||||
(defun char-btn (c low high)
|
||||
(and (char>= c low)
|
||||
(char<= c high)))
|
||||
|
||||
(defun rot-13-cs (cs)
|
||||
(cond ((endp cs) nil)
|
||||
((or (char-btn (first cs) #\a #\m)
|
||||
(char-btn (first cs) #\A #\M))
|
||||
(cons (code-char (+ (char-code (first cs)) 13))
|
||||
(rot-13-cs (rest cs))))
|
||||
((or (char-btn (first cs) #\n #\z)
|
||||
(char-btn (first cs) #\N #\Z))
|
||||
(cons (code-char (- (char-code (first cs)) 13))
|
||||
(rot-13-cs (rest cs))))
|
||||
(t (cons (first cs) (rot-13-cs (rest cs))))))
|
||||
|
||||
(defun rot-13 (s)
|
||||
(coerce (rot-13-cs (coerce s 'list)) 'string))
|
||||
Loading…
Add table
Add a link
Reference in a new issue