Evaluates well-formed reverse polish notation expressions (http://en.wikipedia.org/wiki/Reverse_Polish_notation).
Strings with tokens separated by single spaces. Tokens are operators or operands. Operators are +, -, * or /. Operands are integers or floats (e.g. 7, 3.23, -1e9).
The value of the evaluated expression.
"1 1 +" -> 2
"5 8 -" -> -3
"2 3 7 + -" -> -8
"5 3 * 5 +" -> 20
Current size is 240 bytes. If we use eval, we can cut it down to 164 bytes:
function(i,s,t,j,e){i=i.split(' ');t=[];t.o=t.pop;t.u=t.push;for(j=0;j<i.length;j++){e=i[j];/[\d]+/.test(e)?t.u(e*1):eval('s=t.o(),t.u(t.o()'+e+'s)')};return t[0];}
I'll quote @140bytes on eval: "avoid it if you can, but sometimes ya gotta do what ya gotta do."
Is it possible to remove 100 bytes, or should we aim for the extra 24 bytes in the eval version?