| 77 | } |
| 78 | |
| 79 | func 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. |