RosettaCodeData/Task/Caesar-cipher/Langur/caesar-cipher.langur

11 lines
289 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
val .rot = f(.s, .key) {
cp2s map(f(.c) rotate(rotate(.c, .key, 'a'..'z'), .key, 'A'..'Z'), s2cp .s)
}
val .s = "A quick brown fox jumped over something."
val .key = 3
writeln " original: ", .s
writeln "encrypted: ", .rot(.s, .key)
writeln "decrypted: ", .rot(.rot(.s, .key), -.key)