The JAPH log

Dec 6, 2002

We recently hired a new guy, Chip Salzenberg, who is a perl guru of note. He has a ton of perl shirts, and come to think of it, I've not seen him wear anything else outside of the suit on his interview. anyway, it got me hankering for a another Japh. I tried some fancy stuff, but came up with a nice simple one:

$a=sub{print(map{$a[$_]}$_[0]=~/(.{2})/g)};@a=(a..z,'
',' ',A..Z);$_='372018192728131419070417274332453927'
.'35000210041726';&$a($_);


Jun 17, 2002

I tried compacting Kristy's EVIL JAPH down. I got it three characters smaller, but also added more evil with a map statement, and constructs like "?$/??$_:" and "/(.{6})/g,$/"

map{print ?$/??$_:(($",a..z,A..Z)[ord pack B8,"00".$_])}(unpack
B144,pack H36,"9154d401b38f50815202a7ec9808810cb152")=~/(.{6})/g,$/


Jun 14, 2002

Inspired by Eric's use of strict and an urge to keep things at two lines, Kristy produced this perl pearl:

use strict;$_=qq/ozaxycfstydczcmapbe/;y/fmoz/FMOZ/;s/Za/z/;s/d/mb/;
s/a/fh/;s/c/$"/g;s/Z/UJWQ/;s/b/jw/g;s/e/\n/;y/f-zF-Z/a-uA-U/;print;

Isn't it great how obsessive use of $_ still passes strict?


Jun 14, 2002

Now that Eric and Kristy had send JAPHs I felt compelled to add another. This one is nice and compact. I love the "print($a[$a+=$_])" construct.

@a=("\n",' ',a..z,A..Z);map{$a{$_}=$c++}reverse(@a);for(map{$_=~/\d/?$_*-1:$a{$_}}
'o15%2Y20y13Y:U12/3M18j11M6$38r33X`R6M19'=~/([\d+]+|[\w])/g){print($a[$a+=$_])}


Jun 14, 2002

Not to be outdone, a good friend of mine, Eric Parkin, felt he add to put in his contribution. Not only is this monster a wonderful mind-bend, but it also uses the strict pragma:

use strict;my $j=reverse(unpack('u',"M-S0X-3\@S.#0S,".
"C8U-S\@W.3\@T-S(V.3\@R,S(X,#8Y.#(W-C,R-S(V-38W-S4V)".
".3\@R-#8T-C0V"));my $x=0;while($x<=((length($j)))){$x
==2?print chr(reverse(substr($j, (length($j)-$x),2))):
reverse(substr($j, (length($j) - ($x-2)),2)==32)?print
chr (reverse(substr($j, (length ($j)-$x),2))):print lc
(chr(reverse(substr($j, (length($j)-$x),2)))); $x+=2;}

Ouch.


Jun 13, 2002

Kristy got inspired. She was unhappy that in most JAPHs there is a very obvious 23 character data set that is just mogrified back to being the phrase. She figured that with the character set represented, you could pack it all into a 6-byte space. And that by mis-unpacking that into 8 bytes, get a shorter data set:

for((unpack B144,pack H36,"9154d401b38f50815202a7ec9808810cb152")=~
/(.{6})/g){print (($",a..z,A..Z)[ord pack B8,"00".$_]);}print "\n";

Truly Evil.


Jun 12, 2002

It inspired me to send this mind-screw to several friends. It is based upon a difference pyramid, a geometric number set as I had learned in a historic math class. I believe it is technically a sigma summation:

for(157876010,85825867,46751460,25361566,13618705,7198697,3727214,1882261,
923886,439618,202524,90373,39178,16593,6916,2856,1176,492,222,117,69,39,23,
18){@l2=($_);while(@l1){push(@l2,(pop(@l1)-$l2[$#l2]))}@l1=reverse(@l2)}for
(' ',a..z,A..Z){$a{$c++}=$_}print map{$a{$_}}@l1; print "\n";


Jun 12, 2002

It started with Kristina Davis' sig:

$_="z jyf FpJtwQmxMw hUsjWy";while ($a=chop){$a[(&a($a{'a'}))%23]=$a;}
($a=join "","O",@a)=~y/F-Zf-z/A-Ua-u/; print "$a\n"; sub a {$_[0]+=7;}

The beauty of this Japh is it contains and uses: $a, @a, $a[], %a, $a{} and &a.