Reading a variable

var(V) lists the valid variable indices; lookup(A, V, B) reads variable V’s value out of an assignment:

A file runs one query; change it to ask another. Swap in ?- lookup(0b101, 1, B). to read variable 1 (q): B = 0 (false).