There's no need to define the reverse relation - fooz can do it. Just supply bar and leave the foo fresh.
David On Thu, Nov 13, 2014 at 12:26 PM, <dan.stone16...@gmail.com> wrote: > I think this is a dummy question, but wondering whether this is possible in > core.logic? > > Lets say I have a set of relations > > (db-rel foo p) > (db-rel bar p) > (db-rel fooz p p2) > > and facts > [foo 1] > > [bar 2] > [fooz 2 1] > > [bar 3] > [fooz 3 1] > > See that the fooz relation is potentially describing bar as children of > foo's. (like a foreign key) > > and I want to unify with all the `bar`s for a given `foo` like so: > > (run* [?q] > (fresh [?foo ?bars] > (bars-for-foo ?foo ?bars) > (l/== {:foo ?foo > :bars ?bars} > ?q))) > => > > ({:foo 1, :bar (2 3)}) > > Is it possible to define bars-for-foo? > > > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.