MCPcopy Create free account
hub / github.com/cel-expr/cel-go / minList

Function minList

ext/math.go:849–865  ·  view source on GitHub ↗
(numList ref.Val)

Source from the content-addressed store, hash-verified

847}
848
849func minList(numList ref.Val) ref.Val {
850 l := numList.(traits.Lister)
851 size := l.Size().(types.Int)
852 if size == types.IntZero {
853 return types.NewErr("math.@min(list) argument must not be empty")
854 }
855 min := l.Get(types.IntZero)
856 for i := types.IntOne; i < size; i++ {
857 min = minPair(min, l.Get(i))
858 }
859 switch min.Type() {
860 case types.IntType, types.DoubleType, types.UintType, types.UnknownType:
861 return min
862 default:
863 return types.NewErr("no such overload: math.@min")
864 }
865}
866
867func maxPair(first, second ref.Val) ref.Val {
868 cmp, ok := first.(traits.Comparer)

Callers

nothing calls this directly

Calls 5

NewErrFunction · 0.92
minPairFunction · 0.85
SizeMethod · 0.65
GetMethod · 0.65
TypeMethod · 0.65

Tested by

no test coverage detected