On Monday, September 4, 2017 at 7:49:11 AM UTC-7, Laverne Schrock wrote: > > When I run (run* [q] (fresh [x] (== [x] ['z]) (== q x))), I get (z), > which makes sense. > > When I run (run* [q] (fresh [x] (== q x))), I get (_0), which makes sense > since I've placed no restriction on x. > > However, when I run (run* [q] (fresh [x] (== ['x] ['z]) (== q x))), I get > (), which doesn't make sense to me. Obviously (== ['x] ['z]) is placing > some sort of impossible constraint on x, but I can't tell what that > constraint is actually doing. >
You're asking it to restrict the results to cases where the vector containing symbol x is unifies with the vector containing symbol z. Symbols unify with equality, and 'x does not equal 'z, so you get no results. > Ultimately, what I want to be able to do is something along the lines of: > > (def my-var '[x]) > (run* [q] (fresh [x] (== my-var ['z]) (== q x))) > > and get back (z) instead of (). > That doesn't make a ton of sense; the usage of my-var is evaluated in regular Clojure fashion to be '[x], and it devolves to the same case. It's not really clear what you're trying to do, so it's hard to offer further advice. But you might find the whole enterprise a bit less confusing if you use keywords or strings in the places you're using symbols. - Russell -- 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.