aboutsummaryrefslogtreecommitdiffstats
path: root/op.go
diff options
context:
space:
mode:
Diffstat (limited to 'op.go')
-rw-r--r--op.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/op.go b/op.go
index 6ccc6a8..3a193b6 100644
--- a/op.go
+++ b/op.go
@@ -5,9 +5,12 @@ import (
"math"
)
-// parseOperator returns a closure that performs the specified arithmetic operation,
-// or OpError if op is not a valid operator.
-func parseOperator(op byte) (func(lhs float64, rhs float64) float64, error) {
+// Op is a binary operator.
+type Op func(lhs, rhs float64) float64
+
+// parseOp parses a binary operator, returning a function that performs the operation, or
+// OpError if op is not a valid operator.
+func parseOperator(op byte) (Op, error) {
switch op {
case '+':
return func(lhs, rhs float64) float64 { return lhs + rhs }, nil