Jump to content

Rot-13: Difference between revisions

456 bytes added ,  12 years ago
→‎{{header|Common Lisp}}: The CL standard may be ambiguous, but assuming a modern OS and implementation ASCII is a given.
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:
c))
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}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.