Skip to content
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                   ^


References

Clone this wiki locally