-
Notifications
You must be signed in to change notification settings - Fork 0
Count
Subhajit Sahu edited this page Mar 24, 2021
·
3 revisions
Counts no. of true values. 📰 📘
Can be used to implement one-hot / one-cold detector.
Count[n](a, b, ...)
// a: 1st boolean
// b: 2nd boolean
import (
boolean "github.com/golangf/extra-boolean"
)
boolean.Count(true, true)
// 2
boolean.Count(true, false)
// 1
boolean.Count4(true, true, true, false)
// 3 ^ ^ ^
boolean.Count4(false, true, false, false)
// 1 ^