RosettaCodeData/Task/Rot-13/Maxima/rot-13.maxima

20 lines
570 B
Plaintext

rot13(a) := simplode(map(ascii, map(lambda([n],
if (n >= 65 and n <= 77) or (n >= 97 and n <= 109) then n + 13
elseif (n >= 78 and n <= 90) or (n >= 110 and n <= 122) then n - 13
else n), map(cint, sexplode(a)))))$
lowercase: "abcdefghijklmnopqrstuvwxyz"$
uppercase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"$
rot13(lowercase);
"nopqrstuvwxyzabcdefghijklm"
rot13(uppercase);
"NOPQRSTUVWXYZABCDEFGHIJKLM"
rot13("The quick brown fox jumps over the lazy dog");
"Gur dhvpx oebja sbk whzcf bire gur ynml qbt"
rot13(%);
"The quick brown fox jumps over the lazy dog"