Infix to RPN

Score: 125.38 (pass)

catch pom again!

#!perl -p
y/) 	/
/d;$a.=/\d/?!push
o,$_:/[^(0]/+/[*\/]/&&do{push o,$/while($/=chop$a)=~//;$/.$_}x/./for/(?

Score: 127.37 (pass)

ahh, today rate is done

#!perl -p
y/) 	/
/d;$a.=/\d/?!push
o,$_:/\(/?0:do{push
o,$/while$/=chop$a,/[*\/]/?$/=~//:$/;$/.$_}x/./for/(?

Score: 128.38 (pass)

#!perl -p
y/) 	/
/d;$a.=/\d/?!push
o,$_:/\(/?0:do{push
o,$/while$/=chop$a,/\*|\//?$/=~//:$/;"$/$_"x/./}for/(?

Score: 131.38 (pass)

hmm

#!perl -p
y/) 	/
/d;/\d/?push
o,$_:/\(/?$a.=0:do{push
o,$/while$/=chop$a,/\*|\//?$/=~//:$/;$a.="$/$_"x/./}for/(?

Score: 132.35 (pass)

outrun pom at tie again!

#!perl -p
y/) 	/
/d;/\d/?push
o,$_:/\(/?$a.=0:do{push
o,$/while$/=chop$a,/\*|\//?$/=~//:$/;/
/
or$a.=$/.$_}for/(?

Score: 133.41 (pass)

damn, this looks like the limit for this algorithm, and i wonder what pom will answer?

#!perl -p
y/ 	//d;/\(/?$#a++:/\d/?push
o,$_:do{push
o,$,while$,=pop
a,/[*\/]/?$,=~//:$,;/\)/||push
a,$,,$_}for/(?

Score: 134.71 (fail)

and yet another way how to kill the cat. fast.

Unfortunaly, it fails the test with '1 - -\t2'

#!perl -p
/\(/?push@;,0:/\d/?push@o,$_:do{push@o,pop@;while/\*|\//?$;[-1]=~//:$;[-1];/\)/?pop@;:push@;,$_}for/(?

Score: 136.48 (pass)

looks like my previous attempt failed because i misunderstood 'negative' numbers.

#!perl -p
s/\s//g;/\(/?$#:++:/\d/?push
o,$_:do{push
o,pop@:while/[*\/]$/?"@:"=~//:$:[-1];/\)/?$#:--:push@:,$_}for/(?

Score: 147.61 (pass)

#!perl -pi<([^>]+)>
y/ 	//d;s/(?/g;s/.*/($&)/;1while
s#\(([^()]+)\)#$_=$1;for$i('*/','+-'){s/$^I([$i])$^I/<$1 $3 $2>/&&redo}$_#e;y/<>//d

Score: 155.49 (fail)

hmm, artistic or unortodox? at least it's platform dependant (needs s/'/#/g for windows). and speed is not my fault, it's Deparse's! :)

too slow and platform dependant .. even arthistic / unorthodox need to pass the judge :)

#!perl -p
s/\d+/\$$&/g;s/-/ -/g;close STDERR;$_=`$^X -MO=Deparse,-p -e '$_'`;
$q=qr/\(((??{$q})|-?\$\d+)( .)?( (??{$q})| -?\$\d+)?\)/;
1while s/$q/$1$3$2/;y/$;//d

Score: 171.54 (pass)

who said dead horse? unfortunately changing ${$_[0]} to $${&w} doesn't work

#!perl -pl
BEGIN{@{integer,binary}=(w)x2;sub
w{bless\$_[0]}use
overload'""',sub{${$_[0]}},neg,sub{w"-$_[0]"};for
my$i(qw(+ - * /)){*{"($i"}=sub{w"@_$i"}}$=16e4}s/-/
-/g;$_=eval

Score: 175.48 (pass)

sorry, i missed last stroke. mostly complete now.

#!perl -pl
BEGIN{sub
w{bless\$_[0]}use
overload
neg,sub{w"-$_[0]"},'""',sub{${$_[0]}};
for
my$i(qw(+ - * /)){*{"($i"}=sub{w"@_$i"}}@{integer,binary}=(\&w)x2;$=16e4}s/-/
-/g;$_=eval

Score: 176.48 (pass)

*twitch*

#!perl -pl
BEGIN{sub
w{bless\$_[0]}use
overload
neg,sub{w"-$_[0]"},'""',sub{${$_[0]}};
for
my$i(qw(+ - * /)){*{"($i"}=sub{w"@_$i"}}@{integer,binary}=(\&w)x2;$=152e3}s/-/
-/g;$_=eval

Score: 178.47 (pass)

is it shorterst overload?

#!perl -pl
BEGIN{sub
w{bless\$_[0]}use
overload
neg,sub{w"-$_[0]"},'""',sub{${$_[0]}};
for
my$i(qw(+ - * /)){*{"($i"}=sub{w"@_$i"}}@{integer,binary}=(\&w)x2;$|=151552}s/-/
-/g;$_=eval

Score: 227.80 (pass)

abuse of perl

hmm .. another (ab)use of overload

#!perl -pl
BEGIN{$OVERLOAD{d}++;*{'()'}=sub{};eval"*{'($_'}=sub{bless\\\"\@_$_\",main}"for
qw(+ - * /);*{'(neg'}=sub{bless\"-$_[0]",main};*{'(""'}=sub{${$_[0]}};${integer}=${binary}=sub{bless\$_[0],main};$|=151552}s/--/-
-/;$_=eval

Score: 229.49 (fail)

this B thing crashes too often

Failed with this message : Can't locate object method "padix" via package "B::SVOP" (perhaps you forgot to load "B::SVOP"?)

#!perl -p
use B;s/-/
-/g;s/\d+/\$$&/g;
for($x=($y=B::svref_2object(eval"sub{$_}"))->START,
@v=($y->PADLIST->ARRAY)[1]->ARRAY;$_=($x=$x->next)->name,!/ea/;){
push@a,/n/?-pop@a:/g/?@v[$x->padix]->NAME:/e/?'/':/y/?'*':/s/?'-':'+'
}$_="@a
"