aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-01-28 22:31:43 +0100
committerDimitri Sokolyuk <demon@dim13.org>2017-01-28 22:31:43 +0100
commit7d96315b115e965cbb57c7b515fd2985888f7646 (patch)
tree7e546c51df79667b7bb90469e08864c3baba0a5f
parent2489f58cc6dab3acbd0bd4f9c1b5bc5cb158f7d8 (diff)
Some renames
-rw-r--r--ops.go12
-rw-r--r--verify.go12
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() {