core-logic

tsdh 2015-07-29T09:42:24.000036Z

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)

jballanc 2015-07-29T15:50:21.000037Z

When it comes to working with numbers-as-lvars, I think fd is pretty much your only choice

jballanc 2015-07-29T15:50:51.000038Z

the only other thing I could think of would be to encode them as Church numerals and re-implement basic math as list operations

jballanc 2015-07-29T15:51:51.000039Z

…hmm…or you could use a range with conso in reverse to trim n2 then check with membero for n1