You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
802 B

package main
import (
"github.com/01-edu/z01"
correct "./correct"
4 years ago
student "./student"
)
func main() {
4 years ago
f := []func(int, int) int{
func(accumulator, currentValue int) int {
return accumulator + currentValue
},
func(accumulator, currentValue int) int {
return accumulator - currentValue
},
func(accumulator, currentValue int) int {
return currentValue * accumulator
},
}
argInt := []int{}
type node struct {
4 years ago
a []int
functions []func(int, int) int
}
table := []node{}
for i := 0; i < 4; i++ {
argInt = z01.MultRandIntBetween(0, 50)
4 years ago
table = append(table, node{
a: argInt,
functions: f,
4 years ago
})
}
for _, v := range table {
for _, f := range v.functions {
4 years ago
z01.Challenge("ReduceInt", student.ReduceInt, correct.ReduceInt, f, v.a)
}
}
}