Another Silly programming puzzle....

Hume Smith 850347s at aucs.UUCP
Sat Apr 8 04:43:22 AEST 1989


850347s at aucs.UUCP (Hume Smith) almost, but not quite, wrote
}- exactly why i hate pascal - a hundred lines of illegibility instead of the
}- 2 or 3 you'd have in C.
}- 
}- i wonder if i can do this in Lisp...

read that carefully, i do mean the 2 or 3 lines of illegibilty :-)

this runs under franz lisp... i recommend compiling it though.
Usage: (rot13 t_filename)

(def alpha<=
  (lambda (&rest x)
    (if (or (null x) (null (cdr x)))
        t
        (and (or(eq (car x) (cadr x)) (alphalessp (car x) (cadr x)))
             (apply 'alpha<= (cdr x))))))

(def rot13
  (lambda (file)
    ((lambda (port)
             (do ((X))
                 ((null (setq X (readc port))))
                 (princ
                  (cond ((or (alpha<= 'a X 'm)
                             (alpha<= 'A X 'M))
                         (ascii (+ (getcharn X 1) 13)))
                        ((or (alpha<= 'n X 'z)
                             (alpha<= 'N X 'Z))
                         (ascii (- (getcharn X 1) 13)))
                        (t X))))
             (close port))
     (infile file))))
--
now: HAS THIS BLEEDIN' ROT13 NONSENSE GONE ON LONG ENOUGH?
-- 
Hume Smith	Wolfville  Nova Scotia
BITNET		850347s at Acadia
Internet	850347s%Acadia.BITNET at CUNYVM.CUNY.EDU
UUCP		{uunet|watmath|utai|garfield}!dalcs!aucs!850347s



More information about the Comp.lang.c mailing list