Fork me on GitHub
#core-logic
<
2015-07-29
>
tsdh09:07:24

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)

jballanc15:07:21

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

jballanc15:07:51

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

jballanc15:07:51

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