27 lines
378 B
Io
27 lines
378 B
Io
![]() |
add_op := method(name, action,
|
||
|
ops atPut(name, action)
|
||
|
)
|
||
|
|
||
|
add_op("+", block(a, b, a + b))
|
||
|
add_op("-", block(a, b, b - a))
|
||
|
add_op("*", block(a, b, a * b))
|
||
|
|
||
|
add_op(">", block(a, b,
|
||
|
if(a > b, push(a); return(b), push(b); return(a))
|
||
|
))
|
||
|
|
||
|
add_op(":", block(a, b,
|
||
|
push(b)
|
||
|
push(a)
|
||
|
return(a)
|
||
|
))
|
||
|
|
||
|
add_op("~", block(a, b,
|
||
|
push(a)
|
||
|
return(b)
|
||
|
))
|
||
|
|
||
|
add_op("_", block(a, b,
|
||
|
return(b)
|
||
|
))
|