enum StackMachine::Operation
Overview
Enum for every binary mathematical operaiton.
TODO Figure out a scheme for unary operations.
Defined in:
stackmachine/operations.crEnum Members
-
Add =
0 -
Sub =
1 -
Mul =
2 -
Div =
3
Instance Method Summary
- #add?
-
#call(l : Float64, r : Float64) : Float64
This method performs the mathematical operation represented by the enum.
- #div?
- #mul?
- #sub?
Instance Method Detail
def call(l : Float64, r : Float64) : Float64
#
This method performs the mathematical operation represented by the enum. It will always return an Int32 and truncate on division.
StackMachine::Operation::Add.call(1, 2) # => 3
StackMachine::Operation::Div.call(1, 2) # => 0