17 lines
394 B
Text
17 lines
394 B
Text
|
|
[Float] a
|
|||
|
|
[String = ((Float, Float) -> Float)] b
|
|||
|
|
b[‘+’] = (x, y) -> y + x
|
|||
|
|
b[‘-’] = (x, y) -> y - x
|
|||
|
|
b[‘*’] = (x, y) -> y * x
|
|||
|
|
b[‘/’] = (x, y) -> y / x
|
|||
|
|
b[‘^’] = (x, y) -> y ^ x
|
|||
|
|
|
|||
|
|
L(c) ‘3 4 2 * 1 5 - 2 3 ^ ^ / +’.split(‘ ’)
|
|||
|
|
I c C b
|
|||
|
|
V first = a.pop()
|
|||
|
|
V second = a.pop()
|
|||
|
|
a.append(b[c](first, second))
|
|||
|
|
E
|
|||
|
|
a.append(Float(c))
|
|||
|
|
print(c‘ ’a)
|