I'm not sure I fully understand, I guess I'm looking for the equivalent to
a sub query? When I tried to implement this early, I naively perhaps tried
something like this:

(defn bars-for-foo
  [?foo ?bars]
  (l/== ?bars
    (l/run* [?q]
      (fooz ?foo ?q))))

This seems relevant: http://dev.clojure.org/jira/browse/LOGIC-68



On Thu, Nov 13, 2014 at 5:28 PM, David Nolen <dnolen.li...@gmail.com> wrote:

> 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 a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/qtqzGaHQd2k/unsubscribe.
> To unsubscribe from this group and all its topics, 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.

Reply via email to