replikativ / datahike

A fast, immutable, distributed & compositional Datalog engine for everyone.
https://datahike.io
Eclipse Public License 1.0
1.62k stars 95 forks source link

Fix issue 676: make bind-by-fn require all attrs to have values #677

Closed jonasseglare closed 2 months ago

jonasseglare commented 3 months ago

SUMMARY

Fixes #676 using the following changes:

Discussion about the solution to issue 676: The code in bind-by-fn is currently written in such a way that it assumes all symbols in the function call to be known in the context when the clause is evaluated but there are not checks to ensure that this is actually the case. Maybe there is a way to make it possible for symbols to be unknown but that would probably require a substantial rewrite of bind-by-fn. An easier way to address this problem is to make bind-by-fn return nil, instead of the new context, if not all symbols are known. However, this nil will consequently be returned by -resolve-clause and needs to be handled. We handle that nil by replacing all occurences of (reduce -resolve-clause ...) by (dt/resolve-clauses ...) to handle the nil and retry failed clauses in subsequent iterations.

Checks

Bugfix