MCPcopy
hub / github.com/google/mangle / makeHead

Function makeHead

rewrite/rewrite.go:79–90  ·  view source on GitHub ↗
(sym ast.PredicateSym, vars map[ast.Variable]bool)

Source from the content-addressed store, hash-verified

77}
78
79func makeHead(sym ast.PredicateSym, vars map[ast.Variable]bool) ast.Atom {
80 var orderedVars []ast.BaseTerm
81 for v := range vars {
82 orderedVars = append(orderedVars, v)
83 }
84 // Make the order deterministic. This makes tmp relations reusable between
85 // multiple evaluation runs, e.g. for incremental evaluation.
86 sort.Slice(orderedVars, func(i int, j int) bool {
87 return orderedVars[i].Hash() < orderedVars[j].Hash()
88 })
89 return ast.Atom{sym, orderedVars}
90}
91
92// Get the variables. It is enough to consider those terms where variables
93// can actually be bound.

Callers 1

RewriteFunction · 0.85

Calls 1

HashMethod · 0.65

Tested by

no test coverage detected