Oops, I was not aware eval could evaluate macros, thanks for pointing that out. Indeed, I can just wrap:
(defn sate! [vars expr] (eval `(sat ~vars ~expr))) Thanks for the link too, looks interesting. On Dec 24, 12:48 am, David Nolen <dnolen.li...@gmail.com> wrote: > As your solver is based on rewriting I think you will need to use eval to > get the behavior you want. > > Another approach might behttp://www.soi.city.ac.uk/~jacob/solver/. However > that would require a couple of interesting changes to core.logic (which I'd > be more than happy to include if someone implemented them). > > David > > > > > > > > On Fri, Dec 23, 2011 at 5:39 PM, Peteris <peteris.er...@gmail.com> wrote: > > I don't understand, the value of foo should be independent of the > > values of its arguments, right? > > > To motivate the application better, I want to be able to do symbolic > > computing on the boolean expression prior to passing it into sat, so I > > don't know ahead of time the number of symbols in the expression, nor > > the exact symbols used, nor the boolean expression itself. > > > On Dec 24, 12:15 am, David Nolen <dnolen.li...@gmail.com> wrote: > > > Do something like this not work for you? > > > > (defn foo [p q] > > > (sat [p q] (and p q))) > > > > David > > > > On Fri, Dec 23, 2011 at 5:00 PM, Peteris <peteris.er...@gmail.com> > > wrote: > > > > That's exactly what I wanted to do. Say, be able to write > > > > > (sat '[p q] '(and p q)) > > > > > and I tried working out a function that does this. I've seen examples > > > > of functions on logic variables, but in this case > > > > how could we create fresh logic variables out of these symbols? That > > > > seems like something we would need to be > > > > able to feed into the macro at compile-time. > > > > > On Dec 23, 11:29 pm, David Nolen <dnolen.li...@gmail.com> wrote: > > > > > On Fri, Dec 23, 2011 at 4:10 PM, Peteris <peteris.er...@gmail.com> > > > > wrote: > > > > > > Hi, > > > > > > > I wrote a simple SAT solver macro on top of core.logic today (code > > at > > > > > >http://peteriserins.com/2011/12/23/sat-in-clojure-core-logic.html). > > Is > > > > > > it possible to write a similar SAT solver that would accept > > expression > > > > > > arguments at runtime (say, a SAT function, but not necessarily). > > > > > > > Regards > > > > > > -- > > > > > > Peteris Erins > > > > > > You could change sat to take the unevaluated expression and the > > symbols > > > > > that represent the variables. Do you have some examples illustrating > > the > > > > > kinds of things you would like to do? > > > > > > David > > > > > -- > > > > 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 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 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