We’re rewarding the question askers & reputations are being recalculated! Read more.
4 Application=>App (scala 2.8=>2.9), case "foo"=>case"foo", (u(1)+u(0))=>u(1)+u(0)
source | link

Scala 412 376 349 335 335312:

object P extends ApplicationApp{
def p(t:List[String],u:List[Double]):Double={
def a=u drop 2
t match{
case Nil=>u.head
case x::y=>x match{
case "+"=>pcase"+"=>p(y,(u(1)+u(0))::a)
case "case"-"=>p(y,(u(1)-u(0))::a)
case "*"=>pcase"*"=>p(y,(u(1)*u(0))::a)
case "case"/"=>p(y,(u(1)/u(0))::a)
case d=>p(y,d.toDouble::u)}}}
println (p((readLine() split " ").toList,Nil))}

Scala 412 376 349 335:

object P extends Application{
def p(t:List[String],u:List[Double]):Double={
def a=u drop 2
t match{
case Nil=>u.head
case x::y=>x match{
case "+"=>p(y,(u(1)+u(0))::a)
case "-"=>p(y,(u(1)-u(0))::a)
case "*"=>p(y,(u(1)*u(0))::a)
case "/"=>p(y,(u(1)/u(0))::a)
case d=>p(y,d.toDouble::u)}}}
println (p((readLine() split " ").toList,Nil))}

Scala 412 376 349 335 312:

object P extends App{
def p(t:List[String],u:List[Double]):Double={
def a=u drop 2
t match{
case Nil=>u.head
case x::y=>x match{
case"+"=>p(y,u(1)+u(0)::a)
case"-"=>p(y,u(1)-u(0)::a)
case"*"=>p(y,u(1)*u(0)::a)
case"/"=>p(y,u(1)/u(0)::a)
case d=>p(y,d.toDouble::u)}}}
println(p((readLine()split " ").toList,Nil))}
3 method `def a` instead of multiple `u drop 2`
source | link

Scala 412 376 376 349 349335:

object P extends Application{
def p(t:Seq[String]List[String],u:List[Double]):Double=tDouble={
def a=u drop 2
t match{
case Nil=>u.head
case x::y=>x match{
case "+"=>p(y,(u(1)+u(0))::u.tail.taila)
case "-"=>p(y,(u(1)-u(0))::u.tail.taila)
case "*"=>p(y,(u(1)*u(0))::u.tail.taila)
case "/"=>p(y,(u(1)/u(0))::u.tail.taila)
case d=>p(y,d.toDouble::u)}}}
println (p((readLine() split " ").toList,Nil))}

Scala 412 376 349:

object P extends Application{
def p(t:Seq[String],u:List[Double]):Double=t match{
case Nil=>u.head
case x::y=>x match{
case "+"=>p(y,(u(1)+u(0))::u.tail.tail)
case "-"=>p(y,(u(1)-u(0))::u.tail.tail)
case "*"=>p(y,(u(1)*u(0))::u.tail.tail)
case "/"=>p(y,(u(1)/u(0))::u.tail.tail)
case d=>p(y,d.toDouble::u)}}
println (p((readLine() split " "),Nil))}

Scala 412 376 349 335:

object P extends Application{
def p(t:List[String],u:List[Double]):Double={
def a=u drop 2
t match{
case Nil=>u.head
case x::y=>x match{
case "+"=>p(y,(u(1)+u(0))::a)
case "-"=>p(y,(u(1)-u(0))::a)
case "*"=>p(y,(u(1)*u(0))::a)
case "/"=>p(y,(u(1)/u(0))::a)
case d=>p(y,d.toDouble::u)}}}
println (p((readLine() split " ").toList,Nil))}
2 from "a.dot(b)" to "a dot b", and from List to Seq, and a type inference, and (d) to d.
source | link

Scala 412 376376 349:

object P extends Application{
def p(t:List[String]Seq[String],u:List[Double]):Double=t match{
case Nil=>u.head
case x::y=>x match{
case "+"=>p(y,(u(1)+u(0))::u.tail.tail)
case "-"=>p(y,(u(1)-u(0))::u.tail.tail)
case "*"=>p(y,(u(1)*u(0))::u.tail.tail)
case "/"=>p(y,(u(1)/u(0))::u.tail.tail)
case (d)=>pd=>p(y,d.toDouble::u)}}
println (p((readLine(). split( " ")).toList,List():List[Double]Nil))}

Scala 412 376:

object P extends Application{
def p(t:List[String],u:List[Double]):Double=t match{
case Nil=>u.head
case x::y=>x match{
case "+"=>p(y,(u(1)+u(0))::u.tail.tail)
case "-"=>p(y,(u(1)-u(0))::u.tail.tail)
case "*"=>p(y,(u(1)*u(0))::u.tail.tail)
case "/"=>p(y,(u(1)/u(0))::u.tail.tail)
case (d)=>p(y,d.toDouble::u)}}
println (p((readLine().split(" ")).toList,List():List[Double]))}

Scala 412 376 349:

object P extends Application{
def p(t:Seq[String],u:List[Double]):Double=t match{
case Nil=>u.head
case x::y=>x match{
case "+"=>p(y,(u(1)+u(0))::u.tail.tail)
case "-"=>p(y,(u(1)-u(0))::u.tail.tail)
case "*"=>p(y,(u(1)*u(0))::u.tail.tail)
case "/"=>p(y,(u(1)/u(0))::u.tail.tail)
case d=>p(y,d.toDouble::u)}}
println (p((readLine() split " "),Nil))}
1
source | link