core.logic

Details

Type:
Defect

Status:
Open

Priority:
Minor

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.

Aaron Brooks
added a comment - 16/Nov/12 10:02 PM 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.

Aaron Brooks
added a comment - 17/Nov/12 4:07 PM 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?).

David Nolen
added a comment - 17/Nov/12 8:32 PM 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.

Aaron Brooks
added a comment - 21/Nov/12 10:51 AM - 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.

Aaron Brooks
added a comment - 04/Feb/13 5:50 PM 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.

Aaron Brooks
added a comment - 12/Jun/13 9:03 PM 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!