Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define alph '(#\A #\B #\C #\D #\E #\F #\G #\H #\I #\L #\M #\N #\O #\P #\Q #\R #\S #\T #\V #\X))
- (define getPos
- (lambda (list c p)
- (cond ((null? list) -1)
- ((char=? c (car list)) p)
- (else (getPos (cdr list) c (+ p 1)))
- )
- )
- )
- (define crypt-f
- (lambda (c n)
- (let ((t (+ n (getPos alph c 0))))
- (list-ref alph (remainder t 20)))
- )
- )
- (define crypt-t
- (lambda (n s)
- (if (string=? s "")
- ""
- (string-append (if (char=? (string-ref s 0) #\space) "" (string (crypt-f (string-ref s 0) n))) (crypt-t n (substring s 1)))
- )
- )
- )
- (define caesar
- (lambda (n)
- (lambda (s)
- (crypt-t n s)
- )
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement