Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.logic by

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.

13 Answers

0 votes
by

Comment made by: abrooks

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

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

0 votes
by

Comment made by: abrooks

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.

0 votes
by

Comment made by: abrooks

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?).

0 votes
by

Comment made by: dnolen

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.

0 votes
by

Comment made by: abrooks

I'm considering simply making {{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.

0 votes
by

Comment made by: dnolen

Excellent, thanks much.

0 votes
by

Comment made by: abrooks

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.

0 votes
by

Comment made by: abrooks

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 * }. 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.

0 votes
by

Comment made by: dnolen

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

0 votes
by

Comment made by: abrooks

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!

0 votes
by

Comment made by: dnolen

No worries! Glad Datomic is working out for you :)

0 votes
by

Comment made by: gordongustafson

It's been quite a while, but here's a short patch to implement findall if anyone wants to review. :)

0 votes
by
Reference: https://clojure.atlassian.net/browse/LOGIC-68 (reported by dnolen)
...