mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-24 07:45:15 +00:00
14 lines
194 B
Go
14 lines
194 B
Go
|
package fixedpoint
|
||
|
|
||
|
type Counter func(a Value) bool
|
||
|
|
||
|
func Count(values []Value, counter Counter) int {
|
||
|
var c = 0
|
||
|
for _, value := range values {
|
||
|
if counter(value) {
|
||
|
c++
|
||
|
}
|
||
|
}
|
||
|
return c
|
||
|
}
|