FreshVariable returns a variable different from the ones in used.
(used map[Variable]bool)
| 1336 | |
| 1337 | // FreshVariable returns a variable different from the ones in used. |
| 1338 | func FreshVariable(used map[Variable]bool) Variable { |
| 1339 | makeFresh := func(n int) Variable { return Variable{fmt.Sprintf("X%d", n)} } |
| 1340 | i := 0 |
| 1341 | for { |
| 1342 | v := makeFresh(i) |
| 1343 | if used[v] { |
| 1344 | i++ |
| 1345 | continue |
| 1346 | } |
| 1347 | used[v] = true |
| 1348 | return v |
| 1349 | } |
| 1350 | } |
| 1351 | |
| 1352 | // ReplaceWildcards returns a new term where each wildcard is replaced |
| 1353 | // with a fresh variables. The used-variables map is modified to keep track |
no outgoing calls
no test coverage detected