Hi Mark! condu and conda let you express conditionals/disjunctions, similar to conde, but in which you commit to only one of the clauses. (Hence the name "committed choice operator.") Findall/setof/bagof let you collect all of the results from applying a (possibly non-deterministic) goal 'g' to a term. In this case, you want to try *all* of the conde clauses inside of 'g', and collect up those answers.
There might be a way to express these collection operators in terms of condu/conda. If so, it's not coming to me how to do so. I think it is straightforward to implement these collection operators at the level of the miniKanren implementation, however, which is how I was thinking of doing it. Glad you are enjoying the videos! We haven't talked about condu/conda yet, but I'm sure we will at some point. Cheers, --Will On Sat, Feb 14, 2015 at 10:53 AM, Mark Addleman <[email protected]> wrote: > Hey Will - thanks for responding > > I'm not very familiar with Prolog but setof/bagof seems right. Ultimately, > my use case involves a reduce operation but it seems like I should be able > to compose a recursive conde goal with a bagof goal to achieve what I'm > looking for. > >> Let me see if I can throw together non-relational versions of 'setof' and >> 'bagof' for you. > > That would be great! Right now, I'm leveraging core.logic's very nice > Clojure integration to create a non-relational goal that calls out to a > reduce operation from a run* sequence. I'm pretty sure I don't actually > need a fully relational goal for my use case but my current approach feels > awfully dirty and I like the options that a relational goal would offer. > > ps - - I'm several videos behind on your minikanren uncourse but I'm loving > it! I'm assuming from your response that condu is not the right approach to > my problem making me think I've got the wrong notion of condu. Do you cover > condu in a later video? > > On Friday, February 13, 2015 at 1:11:07 PM UTC-8, William Byrd wrote: >> >> Hi Mark! >> >> Sorry for the late response. >> >> I think what you want is a "collecting goal", such as the >> 'setof'/'bagof' predicates in Prolog. I implemented these predicates >> years ago in miniKanren. I've had recent thoughts on making >> relational variants of these operators in miniKanren, so I'm >> interested in revisiting the topic. Let me see if I can throw >> together non-relational versions of 'setof' and 'bagof' for you. >> >> --Will >> >> On Sun, Feb 1, 2015 at 8:31 PM, Mark Addleman <[email protected]> wrote: >> > I'm using the core.logic implementation of minikanren. >> > >> > I have a goal, element, that produces three values on output: (l/run* >> > [q] >> > (element q)) => (1 2 3) >> > >> > I'd like to write a goal that builds a list of all of the values >> > generated >> > by element: (l/run 1 [q] (build q)) => ((1 2 3)) >> > >> > The best I can come up with is >> > https://gist.github.com/markaddleman/f2e9394f15bf704ca043 but it's >> > obviously >> > wrong. I'm thinking that I should use condu instead of conde for the >> > build >> > goal but I can't seem to wrap my head around how committed-choice works. >> > >> > Any insights? Thanks in advance >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "minikanren" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to [email protected]. >> > To post to this group, send email to [email protected]. >> > Visit this group at http://groups.google.com/group/minikanren. >> > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "minikanren" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/minikanren. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "minikanren" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/minikanren. For more options, visit https://groups.google.com/d/optout.
