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

Function nestedComprehension

cel/cel_test.go:6683–6690  ·  view source on GitHub ↗

nestedComprehension builds `[[..[1]..]].map(vN, .. v1.map(v0, inc(v0)) ..)` at the given depth.

(depth int)

Source from the content-addressed store, hash-verified

6681
6682// nestedComprehension builds `[[..[1]..]].map(vN, .. v1.map(v0, inc(v0)) ..)` at the given depth.
6683func nestedComprehension(depth int) string {
6684 inner := "inc(v0)"
6685 for i := 1; i < depth; i++ {
6686 inner = fmt.Sprintf("v%d.map(v%d, %s)", i, i-1, inner)
6687 }
6688 list := strings.Repeat("[", depth) + "1" + strings.Repeat("]", depth)
6689 return fmt.Sprintf("%s.map(v%d, %s)", list, depth-1, inner)
6690}
6691
6692// TestLateBoundFunctionResolverTraversal asserts that resolving a late-bound function visits each
6693// activation scope at most once, regardless of how deeply the call site is nested inside

Calls

no outgoing calls

Tested by

no test coverage detected