Rot-13: Difference between revisions

Content added Content deleted
No edit summary
(→‎{{header|Common Lisp}}: The CL standard may be ambiguous, but assuming a modern OS and implementation ASCII is a given.)
Line 511: Line 511:
c))
c))
s))</lang>
s))</lang>

====Assuming ASCII Character Set====
Though the standard intentionally doesn't specify encoding, every popular implementation today uses ASCII.
<lang lisp>(defun rot13 (string)
(map 'string
(lambda (char &aux (code (char-code char)))
(if (> (- code (char-code (if (upper-case-p char)
#\A #\a))) 12)
(code-char (- code 13))
(code-char (+ code 13))))
string))</lang>


=={{header|D}}==
=={{header|D}}==