On Sun, Dec 2, 2012 at 1:42 PM, Jonas <jonas.enl...@gmail.com> wrote:
> > > On Sunday, December 2, 2012 7:33:17 PM UTC+2, David Nolen wrote: > >> On Sat, Dec 1, 2012 at 12:24 AM, Jonas <jonas....@gmail.com> wrote: >> >>> >>> * Predicates on logic vars: >>> [(foo (? x number?)) (bar ?x)] => match (foo 42) but not (foo :bar) >>> >> >> This is now possible since we have constraints. >> > > Awesome. Is this already in a released version of core.logic? Do you know > of any examples I might study? > Not yet - but you can look at the code in master (and the tests) for some ideas. I plan on adding what Kevin needs fairly soon to the simple unifier and documenting it the high level interface - it will probably use the CVar functionality I mentioned. It's a bit hard to make any promises about the details of the constraint functionality as it's likely to change as I better understand how all of this should work. > * Segment vars: >>> [(* ??x 1 ??y) (* ??x ??y)] => (* 4 3 2 1 2 3 4) would turn into (* >>> 4 3 2 2 3 4) >>> and >>> [(* ??x 0 ??y) 0] => (* 1 2 3 0 4 5 6 7) would turn into 0 >>> >> >> This has been possible for some time - but you need to extend >> unification. You need to create a wrapper around sequences and a new kind >> of logic var. Kevin's work on the partial map (PMap) functionality is a >> good starting point as well the work I've done on constrained vars (CVar). >> > > I'd be interested in creating an SVar ("segment var") then. I'll start by > trying to understand yours and Kevins work on CVar/PMap. > I'm not convinced this needs to be in core.logic proper but I'm more than happy to answer any questions once you understand how PMap & CVar work. It's a goal to allow many kinds of extensions to core.logic w/o needing to directly modify the core. 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