Re: Core.logic, dynamically generated goals

2012-05-22 Thread Alex Robbins
Good to think about. Thanks Brian. On Sun, May 20, 2012 at 5:44 PM, Brian Marick wrote: > > On May 19, 2012, at 1:12 PM, Alex Robbins wrote: > >> Is it possible to use dynamically generated goals in run* ? > > You might want to think macros. I have written macros that tweak `run` bodies > for va

Re: Core.logic, dynamically generated goals

2012-05-20 Thread Brian Marick
On May 19, 2012, at 1:12 PM, Alex Robbins wrote: > Is it possible to use dynamically generated goals in run* ? You might want to think macros. I have written macros that tweak `run` bodies for various purposes: `(~@runner [~qvar] (l/fresh [~(gensyms :procedure) ~(gens

Re: Core.logic, dynamically generated goals

2012-05-19 Thread Alex Robbins
Oh, so instead of trying to unroll my requirements into a bunch of conditions, just make a single condition function that checks through the list. That helps a lot! Thanks! Alex On Sat, May 19, 2012 at 2:11 PM, Jason Jackson wrote: > Are you trying to see if a person meets multiple requirements?

Re: Core.logic, dynamically generated goals

2012-05-19 Thread Jason Jackson
Are you trying to see if a person meets multiple requirements? Here's how: (defrel grade person course g) (fact grade 'Bob 'Algebra 'B) (fact grade 'Bob 'Art 'C) (fact grade 'John 'Algebra 'A) (fact grade 'John 'Art 'A) (fact grade 'Ricky 'Algebra 'D) (fact grade 'Ricky 'Art 'A) (defn meet

Re: Core.logic, dynamically generated goals

2012-05-19 Thread Alex Robbins
Hmm, I didn't explain it very well. What if I had more knowledge? Maybe I knew two grades sometimes. That could cut down on the list of possible students (assuming there are more than the three in my example). How could I write a function that worked for both of these cases? (matches [{:course 'Al

Re: Core.logic, dynamically generated goals

2012-05-19 Thread David Nolen
I don't think you need to generate goals for something as straightforward as this: (defrel grade person course g) (fact grade 'Bob 'Algebra 'B) (fact grade 'Bob 'Art 'C) (fact grade 'John 'Algebra 'A) (fact grade 'John 'Art 'A) (fact grade 'Ricky 'Algebra 'D) (fact grade 'Ricky 'Art 'A) (defn mat

Core.logic, dynamically generated goals

2012-05-19 Thread Alex Robbins
I'm just getting started with logic programming, and it is entirely possible I'm just approaching this incorrectly. Is it possible to use dynamically generated goals in run* ? For example, (defrel grade person course g) (fact grade 'Bob 'Algebra 'B) (fact grade 'Bob 'Art 'C) (fact grade 'John 'A