Re: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-27 Thread nchurch
That makes a lot more sense with the variable names, thanks! I think I hadn't realized until this point that a goal is also a function. Much to learn On Apr 27, 2:53 am, Daniel Kwiecinski wrote: > Ok, so the function (let's name it for-all)  is: > > (defn for-all >   "A goal that succeeds if

Re: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-27 Thread Daniel Kwiecinski
Ok, so the function (let's name it for-all) is: (defn for-all "A goal that succeeds if all goals succeeds." [goal first-param list] (fresh [head rest] (conso head rest list) (goal first-param head) (for-all goal first-param rest))) it takes 3 parameters. 1. a goal, 2. first parame

Re: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread nchurch
For the benefit of bystanders, could anyone explain why and how Daniel's for-all function works? (I've gotten to chapter 4 of TRS.) On Apr 26, 2:04 pm, David Nolen wrote: > core.logic can remember previous results via tabling. > > As far as n-queens - that's a problem best left for constraint lo

Re: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread David Nolen
core.logic can remember previous results via tabling. As far as n-queens - that's a problem best left for constraint logic programming (CLP). core.logic doesn't have constraint programming facilities yet, but I've mentioned the desire to implement cKanren many times on this list. Haven't really c

Re: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread Daniel Kwiecinski
So how would you tackle, lets say n-queen problem on m square board (for realy huge m) knowing that additional small set of chess pieces can be added to the problem (let's say K K N N B) the new pieces attack fraction of the board potentially not taken by any queens so far. Some of prev solutions w

Re: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread David Nolen
On Thu, Apr 26, 2012 at 1:38 PM, Daniel Kwiecinski < daniel.kwiecin...@gmail.com> wrote: > Does it make sense at all to you. > Makes sense, but sounds outside the scope of what core.logic currently does. David -- You received this message because you are subscribed to the Google Groups "Clojur

Re: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread David Nolen
Oops didn't read closely enough. Yes, your solution looks good to me. On Thu, Apr 26, 2012 at 1:08 PM, Daniel Kwiecinski < daniel.kwiecin...@gmail.com> wrote: > Is there such standard goal in clojure.logic or do I need to write > something like: > > > (defn for-all > > > > "A goal that succeeds

Re: a goal succeeding when given another goal succeeds for all elements in a list

2012-04-26 Thread David Nolen
Depends on what you're doing but one simple way is: (defn for-all [gs] (if (seq gs) (all gs (for-all (rest gs))) s#)) On Thu, Apr 26, 2012 at 1:08 PM, Daniel Kwiecinski < daniel.kwiecin...@gmail.com> wrote: > Is there such standard goal in clojure.logic or do I need to writ