Say you have a unary relation (1to10 n)
which unifies n
with the 1, 2,... , 10. And say you have two logic variables n1
and n2
both resulting from unification with 1to10
, and you want to express that n1
comes before n2
in 1to10
. Is that possible? (`clojure.core.logic.fd/<` is of course cheating)
When it comes to working with numbers-as-lvars, I think fd
is pretty much your only choice
the only other thing I could think of would be to encode them as Church numerals and re-implement basic math as list operations
…hmm…or you could use a range with conso
in reverse to trim n2
then check with membero
for n1