From 7d96315b115e965cbb57c7b515fd2985888f7646 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 28 Jan 2017 22:31:43 +0100 Subject: Some renames --- ops.go | 12 ++++++------ verify.go | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ops.go b/ops.go index bca0acd..7d35e0d 100644 --- a/ops.go +++ b/ops.go @@ -63,14 +63,14 @@ func (m Element) mul(n Element) Element { return m.prev().mul(n).add(n) } -// Pot defines power function -func Pot(m, n Element) Element { return m.pot(n) } +// Pow defines power function +func Pow(m, n Element) Element { return m.pow(n) } -func (m Element) pot(n Element) Element { +func (m Element) pow(n Element) Element { if n == zero { return one } - return m.pot(n.prev()).mul(m) + return m.pow(n.prev()).mul(m) } // Sub defines substraction @@ -93,8 +93,8 @@ func (m Element) String() string { return fmt.Sprint(m.Value) } -// Scan returns n-th Element -func Scan(n int) Element { +// Index returns n-th Element +func Index(n int) Element { if n > alphabet.Len() { log.Fatal("out of range ", n) return Element{} diff --git a/verify.go b/verify.go index 9403e50..b5337e1 100644 --- a/verify.go +++ b/verify.go @@ -35,8 +35,8 @@ var cases = map[string]testCase{ order: false, }, "^": testCase{ - function: Pot, - expect: expectPot, + function: Pow, + expect: expectPow, maxm: 10, maxn: 3, order: false, @@ -63,9 +63,9 @@ func verify(op string) (string, bool) { } e := c.expect(m, n) - me := Scan(m) - ne := Scan(n) - ee := Scan(e) + me := Index(m) + ne := Index(n) + ee := Index(e) re := c.function(me, ne) return fmt.Sprint(me, op, ne, "=", re), re.Equals(ee) @@ -73,7 +73,7 @@ func verify(op string) (string, bool) { func expectAdd(m, n int) int { return m + n } func expectMul(m, n int) int { return m * n } -func expectPot(m, n int) int { return int(math.Pow(float64(m), float64(n))) } +func expectPow(m, n int) int { return int(math.Pow(float64(m), float64(n))) } func expectSub(m, n int) int { return m - n } func verifyAll() { -- cgit v1.2.3