Re: Using a dynamic number of lvars in core.logic.

2012-11-27 Thread David Nolen
Yep infd's api is a bit annoying - I'd like to change it to match distinctfd. David On Tue, Nov 27, 2012 at 5:57 PM, Frederik De Bleser wrote: > I had some trouble because all goals need to take in the list of lvars. > `infd` doesn't take in a list, but your sudoku blog post has `all-infd` > wh

Re: Using a dynamic number of lvars in core.logic.

2012-11-27 Thread Frederik De Bleser
I had some trouble because all goals need to take in the list of lvars. `infd` doesn't take in a list, but your sudoku blog post has `all-infd` which does the trick: (defn all-infd "Assign a domain to all vars." [vars domain] (if (seq vars) (all (domfd (f

Re: Using a dynamic number of lvars in core.logic.

2012-11-26 Thread David Nolen
`gensym` doesn't create logic vars, `lvar` does. Use `lvar` not `gensym`. David On Mon, Nov 26, 2012 at 12:48 PM, Frederik De Bleser wrote: > Hey David, > > I don't quite understand how I would apply your suggestion this with my > example. > > 1. So the "all" function creates a choice point. H

Re: Using a dynamic number of lvars in core.logic.

2012-11-26 Thread Frederik De Bleser
Hey David, I don't quite understand how I would apply your suggestion this with my example. 1. So the "all" function creates a choice point. How do I create lvars? I tried: (run* [q] (let [vars (repeatedly 3 #(gensym 'x))] (all (== q vars ;=> ((x4388 x4389 x4390)) Shouldn't I

Re: Using a dynamic number of lvars in core.logic.

2012-11-26 Thread David Nolen
You can do something like the following: (run [q] (let [vars (repeatedly some-n lvar)] (all (== q vars functional programming FTW ;) David On Mon, Nov 26, 2012 at 10:22 AM, Frederik De Bleser wrote: > Using core.logic, I sometimes have the need to create a variable number of