core-logic

2016-06-02T16:58:01.000009Z

Hi. I was wondering : how can I sort multiple results coming out of run* ? The idea is to sort them using core.logic itself by expressing preferences rules ? In particular, I’m wondering how I can express an ‘arbitrary’ preference order such as : prefer ?a over ?b. I’ve already used systems that worked this way : they checked for acyclicity so as to avoid contradiction in the preference statements (which were just binary relations).

2016-06-02T17:01:27.000010Z

I think i really am just looking for a way to make a topological sort. Any idea ?

2016-06-02T17:05:37.000011Z

minikanren, on which core.logic is based, does this interleaving of goals to make it so non-convergent goals don't continue to not converge infinitely while a convergent goal never gets a chance to run

2016-06-02T17:06:15.000012Z

I think that would make it difficult to impossible to get ordering without some deeper modifications

2016-06-02T17:09:07.000013Z

https://scholarworks.iu.edu/dspace/bitstream/handle/2022/8777/Byrd_indiana_0093A_10344.pdf you can search for "interleaving" to read more about it, they mention it a lot, are very proud of it, and contrast it with prolog

2016-06-02T17:12:26.000014Z

without the interleaving, given a conde, the first branch would be searched exhaustively, then the next, etc

2016-06-02T17:28:52.000015Z

Indeed this seems non-trivial, I’m probably better off doing the sort using functional programming rather than relational programming. Actually, I’m currently investigating minikanren in order to express business rules. I haven’t found much resources about this and I must confess I am somehow disappointed – but maybe this is because I haven’t employed many rules in my experiments so far. I’d be interested in reading stuffs (blogs, books, whatever) about solving business related problems with minikanren. So far, most of the use of minikanren I saw concerned small problems that had some kind of mathematical purity at their heart (the sudoku solver for instance), whereas I’m trying to determine if it could be of any use in cases where there a many rules such as in a business related environment (for instance, billing rules).

2016-06-02T17:31:23.000016Z

minikanren isn't a rules engine

2016-06-02T17:41:28.000017Z

with a billing system in minikanren, you could ask questions like "is it possible to get a bill with the properties x y and z", which is interesting and in many circumstances useful, but I think most businesses are concerned with if this then that style rules, which you can do in a relational language, but you'll be able to do better using a rules engine

2016-06-02T17:43:52.000018Z

I think this split is what is referred to as backwards chaining (what relational languages do) and forward chaining (what rules engines do)

2016-06-02T17:44:23.000019Z

the split isn't entirely black and white, mature rules engines and relational environments tend to support both