Fork me on GitHub

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))


On researching, here's what I found so far. I'll post here as I make tests: (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)))


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.