Arithmetic evaluation: Difference between revisions
Content added Content deleted
(Added Tailspin solution) |
m (→{{header|Tailspin}}: slightly more readable) |
||
Line 5,981: | Line 5,981: | ||
<lang tailspin> |
<lang tailspin> |
||
templates variadicToBinary |
templates variadicToBinary |
||
when <[](1)> $(1) ! |
when <[](1)> do $(1) ! |
||
otherwise [ { left: $(1), op: $(2), right: $(3)}, $(4..last)...] -> # |
otherwise [ { left: $(1), op: $(2), right: $(3)}, $(4..last)...] -> # |
||
end variadicToBinary |
end variadicToBinary |
||
Line 6,000: | Line 6,000: | ||
<{op: <='*'>}> ($.left -> evaluateArithmetic) * ($.right -> evaluateArithmetic) ! |
<{op: <='*'>}> ($.left -> evaluateArithmetic) * ($.right -> evaluateArithmetic) ! |
||
<{op: <='/'>}> ($.left -> evaluateArithmetic) ~/ ($.right -> evaluateArithmetic) ! |
<{op: <='/'>}> ($.left -> evaluateArithmetic) ~/ ($.right -> evaluateArithmetic) ! |
||
otherwise $ ! |
|||
end evaluateArithmetic |
end evaluateArithmetic |
||