[ create a new paste ] login | about

Project: programmingpraxis
Link: http://programmingpraxis.codepad.org/xSLxDTmO    [ raw code | output | fork ]

programmingpraxis - Scheme, pasted on Feb 20:
1
2
3
4
5
6
7
8
9
10
11
12
(define (rot13 s)
  (define (char-plus c n)
    (integer->char (+ n (char->integer c))))
  (define (rot c)
    (cond ((char<=? #\a c #\m) (char-plus c 13))
          ((char<=? #\n c #\z) (char-plus c -13))
          ((char<=? #\A c #\M) (char-plus c 13))
          ((char<=? #\N c #\Z) (char-plus c -13))
          (else c)))
  (list->string (map rot (string->list s))))

(display (rot13 "Cebtenzzvat Cenkvf vf sha!"))


Output:
1
Programming Praxis is fun!


Create a new paste based on this one


Comments: