-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🧠 Logic: current_predicate
random display
#695
Comments
By implementing ordered procedures in the prolog interpreter (axone-protocol/prolog), we should ensure in the logic module that registration of predicate is also ordered. It's not the case now. Registry also rely on a builtin A modification in the logic module should handle the registration of all predicates in a same order across nodes. |
I agree with that strategy, to make the management of predicates deterministic in the VM. An easier solution would've been to provide an alternative implementation of the @ccamel What do you think? |
current_predicate
random displaycurrent_predicate
random display
📝 Description
The Prolog predicate
current_predicate/1
is used to verify the existence of a predicate with a specified name and arity within the current context. Additionally, when used in addition withfindall/3
, it can retrieve a complete list of predicates registered in the interpreter. However, an issue arises when requesting this list of registered predicates: the returned list is displayed in a random order, varying with each request.🔎 Analysis
The root of the issue stems from the VM, which maintains the list of registered procedures through a
map[procedureIndicator]procedure
. Given that maps in Go are inherently unordered, iterating over this procedures map to return the list of predicates results in a display order that is random and inconsistent.There are multiple potential solutions to address this issue:
current_predicate/1
predicate to alter its behavior accordingly.Those modifications should relay on prolog interpreter module.
The text was updated successfully, but these errors were encountered: