Rot-13: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 41: | Line 41: | ||
.storeit sta (buffer),y |
.storeit sta (buffer),y |
||
jmp next</lang> |
jmp next</lang> |
||
=={{header|ACL2}}== |
|||
<lang lisp>(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))</lang> |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |