in reply to Eval Squared
So, it looks good. First pass, can't parse. Fine. perl -MO=Deparse doesn't help either. So I try a new trick from a fellow monk (instead of performing the intermediary steps manually):
$ sed s/eval/print/ zshzn.pl | perl
which yields:
open$:,shift;$/=undef;$_=<$:>;><+-.,cd;s!(.)!$1 !g;s!((?:<\s) {2,})!'$ +b-='.(length($1)/2).";"!gex;s!((?:>\s) {2,})!'$b+='.(length($1)/2)."; +"!gex;s!((?:\+\s){2,})!'$a[$b]+='.(length($1)/2).";"!ge;s!((?:\-\s){2 +,})!'$a[$b]-='.(length($1)/2).";"!ge;s!>\s !\$b++;!gx;s!<\s !\$b--;!g +x;s!([+-])\s!\$a[\$b]$1$1;\n!g;s!\.\s!print chr(\$a[\$b]);!g;s!,\s !\ +$a[\$b]=ord(substr(<>,0,1));!gx;s!\[\s!while(\$a[\$b]){!g;s!(?<=\s)\] +\s!}!g;print;
Now, I don't particularly feel like formatting all that by hand, so I:
$ s/eval/print/ | perl | perl -MO=Deparse
which yields:
syntax error at - line 1, near ";>" - had compilation errors.
So I fail challenge #1.
So I try the following:
$ perl zshzn.pl $ perl zshzn.pl file.txt $ cat file.txt | perl zshzn.pl $ perl zshzn.pl 10
All of which do nothing.
So the answer to #1 changes to: you're just doing an expensive noop that compiles cleanly the first time around. You produce no output by default, or when given input by a number of means. So I think that makes the answer to #2: the mistake in the implementation is that you've forgotten to do anything!!! :-)
So as far as what this member of the monastery thinks, it reminds of the dirty joke about the man who goes to the doctor looking awful but feeling great... But in this case, the appearance is quite titillating, but serves no useful practical purpose to me, which almost makes me expect to see another obfuscation, equally as appealing, abreast this one.
$,=42;for(34,0,-3,9,-11,11,-17,7,-5){$*.=pack'c'=>$,+=$_}for(reverse s +plit//=>$* ){$%++?$ %%2?push@C,$_,$":push@c,$_,$":(push@C,$_,$")&&push@c,$"}$C[$# +C]=$/;($#C >$#c)?($ c=\@C)&&($ C=\@c):($ c=\@c)&&($C=\@C);$%=$|;for(@$c){print$_^ +$$C[$%++]}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Eval Squared
by truedfx (Monk) on Apr 06, 2006 at 09:27 UTC | |
by ruoso (Curate) on Apr 10, 2006 at 22:39 UTC | |
|
Re^2: Eval Squared
by zshzn (Hermit) on Apr 06, 2006 at 12:20 UTC |