Пример #1
0
// Unary constructor returns a boolean unary operator which implements the gp.Opcode interface
func Unary(name string, fun func(a V) V) gp.Opcode {
	return unaryOp{gp.Function(name, 1), fun}
}
Пример #2
0
// Func constructor returns a boolean function with given arity which implements the gp.Opcode interface
func Func(name string, arity int, fun func([]V) V) gp.Opcode {
	return boolFunc{gp.Function(name, arity), fun}
}