github.com/tobgu/qframe@v0.4.0/internal/bcolumn/aggregations.go (about)

     1  package bcolumn
     2  
     3  var aggregations = map[string]func([]bool) bool{
     4  	"majority": majority,
     5  }
     6  
     7  func majority(b []bool) bool {
     8  	tCount, fCount := 0, 0
     9  	for _, x := range b {
    10  		if x {
    11  			tCount++
    12  		} else {
    13  			fCount++
    14  		}
    15  	}
    16  
    17  	return tCount > fCount
    18  }