Fork me on GitHub
#core-logic
<
2017-01-22
>
nathansmutz04:01:56

Is there any way to emulate set operations in core.logic? It looks like everyg wont work on an LCons so you can't make relational goals like: (defn subseto [sub super] (everyg* #(membero % super) sub))

nathansmutz09:01:40

On researching, here's what I found so far. I'll post here as I make tests: https://gist.github.com/martintrojer/3792630 (defne subseto "is s1 is a subset of s2?" [s1 s2] ([() _]) ([[x . xs] _] (membero x s2) (subseto xs s2))) (defne any-membero "any member of s1 is a member of s2?" [s1 s2] ([[x . xs] _] (membero x s2)) ([[x . xs] _] (any-membero xs s2)))

nathansmutz19:01:11

This works: (run 5 [q] (distincto q) (subseto q [1 2])) Doing a "(run 6 ..." with the above hangs. I'm off to learn more kanren-foo. Maybe something with walk can make this halt. I hope its a solvable problem.