This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

JAGH



All this talk of continuations gave me an idea on another way we can
beat Perl at it's own game. Perl has a tradition of miniature programs
that print out a particular string in obfuscated ways.

But with perl you can only really obfuscate the syntax. Since Scheme
has call/cc, you can obfuscate the semantics itself. Here is a Guile
script that generates appropriate output, in .sig-ready format:

guile -c '(define call/cc call-with-current-continuation)(define(p s)(lambda(o)(
let((n(call/cc(lambda(x)(o x)x))))(let loop((n n)(l(string->list s)))(if(not(
null? l))(begin(display(car l))(loop(call/cc n)(cdr l))))))))((p "Js nte ul akr"
)(p "utAohrGieHce "))'


Here it is with a bit more whitespace, to prove that I'm not resorting
to mere syntactic obfuscation. I admit this effort isn't very deeply
obfuscated once you figure out what's going on, but I kind of like the
elegant simplicity.


(define call/cc call-with-current-continuation)

(define (p s)
  (lambda (o)
    (let ((n (call/cc (lambda (x) (o x) x))))
     (let loop ((n n)
		(l (string->list s)))
       (if (not (null? l))
	   (begin (display (car l))
		  (loop (call/cc n) (cdr l))))))))

((p "Js nte ul akr") (p "utAohrGieHce "))


 - Maciej Stachowiak