core.logic

add Prolog meta-logical predicates bagof, setof, findall

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

This can be done by annotating logic variables and embedding a run within a run by passing in the current substitution, running on it, and extracting out the reified values and unifying it back into the current substitution.

Activity

Hide
Aaron Brooks added a comment -

I'm working on understanding the answers given for this StackOverflow question:

http://stackoverflow.com/questions/7647758/prolog-findall-implementation

Show
Aaron Brooks added a comment - I'm working on understanding the answers given for this StackOverflow question: http://stackoverflow.com/questions/7647758/prolog-findall-implementation
Hide
Aaron Brooks added a comment -

For discussion — Initial working patch supporting nested version of 'run-a/'run-a*. Binding symbols must match existing lvars with which vectors of all returned values will be unified.

Show
Aaron Brooks added a comment - For discussion — Initial working patch supporting nested version of 'run-a/'run-a*. Binding symbols must match existing lvars with which vectors of all returned values will be unified.
Hide
Aaron Brooks added a comment -

Should we provide wrappers that emulate each of bagof, setof and findall?

I'm still not sold on the current names run-a/run-a*. "a" is really an internal implementation detail. Expect a revised patch with better names when I think of them (any ideas?).

Show
Aaron Brooks added a comment - Should we provide wrappers that emulate each of bagof, setof and findall? I'm still not sold on the current names run-a/run-a*. "a" is really an internal implementation detail. Expect a revised patch with better names when I think of them (any ideas?).
Hide
David Nolen added a comment -

Yes please. Yeah I don't think the names of run-a/etc are critical - implementation details for now until we really understand the implications and it gets some use.

Show
David Nolen added a comment - Yes please. Yeah I don't think the names of run-a/etc are critical - implementation details for now until we really understand the implications and it gets some use.
Hide
Aaron Brooks added a comment - - edited

I'm considering simply making run/run* conditionalized on the first argument, using the nesting form if we are being called with a substitution map as the first argument.

My current understanding of bagof and findall makes me think they're not worth implementing beyond the nesting run functionality.

I'm still thinking about setof which is quite useful and will want help from the infrastructure to be fully efficient.

I'll submit a new patch after Thanksgiving.

Show
Aaron Brooks added a comment - - edited I'm considering simply making run/run* conditionalized on the first argument, using the nesting form if we are being called with a substitution map as the first argument. My current understanding of bagof and findall makes me think they're not worth implementing beyond the nesting run functionality. I'm still thinking about setof which is quite useful and will want help from the infrastructure to be fully efficient. I'll submit a new patch after Thanksgiving.
Hide
David Nolen added a comment -

Excellent, thanks much.

Show
David Nolen added a comment - Excellent, thanks much.
Hide
Aaron Brooks added a comment -

I have not forgotten, I've just gotten swamped.

There's a small chance I'll get to this before Christmas, otherwise, it's after the new year.

Show
Aaron Brooks added a comment - I have not forgotten, I've just gotten swamped. There's a small chance I'll get to this before Christmas, otherwise, it's after the new year.
Hide
Aaron Brooks added a comment -

After a car accident, travel to London and Morocco, getting caught up at work and getting caught up on the apparently very busy stream of core.logic activity (great work!), I'm back on this.

I found some bugs in my implementation after porting the patch forwards and realized these issues highlighted my sloppy understanding of some of the semantics I had created.

I'm fairly convinced now that we don't want to name this after run or run*. It's too much of a strain to try to make it mean the same thing in a nested context.

The current mechanism is still not quite a match for findall/bagof/setof, however, so I'm seeing what a good fit would be. I'll post meaningful thoughts for review as I have them.

Show
Aaron Brooks added a comment - After a car accident, travel to London and Morocco, getting caught up at work and getting caught up on the apparently very busy stream of core.logic activity (great work!), I'm back on this. I found some bugs in my implementation after porting the patch forwards and realized these issues highlighted my sloppy understanding of some of the semantics I had created. I'm fairly convinced now that we don't want to name this after run or run*. It's too much of a strain to try to make it mean the same thing in a nested context. The current mechanism is still not quite a match for findall/bagof/setof, however, so I'm seeing what a good fit would be. I'll post meaningful thoughts for review as I have them.
Hide
David Nolen added a comment -

Glad to hear you're OK! No worries, will take a patch whenever you get around to one.

Show
David Nolen added a comment - Glad to hear you're OK! No worries, will take a patch whenever you get around to one.
Hide
Aaron Brooks added a comment -

Having switched to Datomic which has bagof/setof type aggregation and subqueries (though the switch wasn't for those specifically) I don't know if or when I'll get back to this. Sorry!

Show
Aaron Brooks added a comment - Having switched to Datomic which has bagof/setof type aggregation and subqueries (though the switch wasn't for those specifically) I don't know if or when I'll get back to this. Sorry!
Hide
David Nolen added a comment -

No worries! Glad Datomic is working out for you

Show
David Nolen added a comment - No worries! Glad Datomic is working out for you

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: