scala/ex.scala
changeset 201 09befdf4fc99
parent 200 8dde2e46c69d
child 205 c7975ab7c52e
equal deleted inserted replaced
200:8dde2e46c69d 201:09befdf4fc99
    46 println("Compiled Mult 3 * 5: " + toTM(Mult(0, 1, 2, 3, Int.MaxValue).p).run(Tape(3,5,0,0)))
    46 println("Compiled Mult 3 * 5: " + toTM(Mult(0, 1, 2, 3, Int.MaxValue).p).run(Tape(3,5,0,0)))
    47 println("Compiled Expo 3 ^ 4: " + toTM(Expo(0, 1, 2, 3, 4, 10000).p).run(Tape(3,4,0,0,0)))
    47 println("Compiled Expo 3 ^ 4: " + toTM(Expo(0, 1, 2, 3, 4, 10000).p).run(Tape(3,4,0,0,0)))
    48 
    48 
    49 // Recursive function examples 
    49 // Recursive function examples 
    50 println("Add 3 4:   " + Add.eval(3, 4))
    50 println("Add 3 4:   " + Add.eval(3, 4))
    51 println("Mult 3 4:   " + recs.Mult.eval(3, 4))
    51 println("Mult 3 4:  " + recs.Mult.eval(3, 4))
    52 println("Twice 4:   " + Twice.eval(4))
    52 println("Twice 4:   " + Twice.eval(4))
    53 println("FourTm 4:  " + Fourtimes.eval(4))
    53 println("FourTm 4:  " + Fourtimes.eval(4))
    54 println("Pred 9:    " + Pred.eval(9))
    54 println("Pred 9:    " + Pred.eval(9))
    55 println("Pred 0:    " + Pred.eval(0))
    55 println("Pred 0:    " + Pred.eval(0))
    56 println("Minus 6 2: " + Minus.eval(6, 2))
    56 println("Minus 6 2: " + Minus.eval(6, 2))