This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-22
Channels
- # beginners (10)
- # boot (134)
- # cider (29)
- # clara (2)
- # cljs-dev (10)
- # cljsjs (2)
- # cljsrn (13)
- # clojure (76)
- # clojure-india (4)
- # clojure-ireland (1)
- # clojure-russia (20)
- # clojure-spec (11)
- # clojure-uk (7)
- # clojurescript (88)
- # core-async (5)
- # core-logic (3)
- # cursive (17)
- # datascript (5)
- # datomic (123)
- # hoplon (8)
- # klipse (6)
- # lambdaisland (2)
- # leiningen (4)
- # luminus (2)
- # off-topic (23)
- # om (23)
- # om-next (1)
- # onyx (20)
- # pedestal (2)
- # perun (2)
- # re-frame (11)
- # ring-swagger (3)
- # untangled (12)
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: 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)))
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.