-
Notifications
You must be signed in to change notification settings - Fork 127
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
rebis-dev: Top level: unusual ordering of new variable names #1196
Comments
In master they are all the same |
Please note that this is serious. |
I think it is worth appreciating why this issue, which may appear unimportant at first, is in fact important: If I understand correctly, the reason is that with a reliable order of variables in answer substitutions, we can easily obtain any order we want on the toplevel. For instance, suppose I get solutions that show the binding for ?- n_factorial(N, F). N = 0, F = 1 ; N = 1, F = 1 ; N = 2, F = 2 ; N = 3, F = 6 ; N = 4, F = 24 ; ... Then I can easily enforce a variable order in answer substitutions that first emits the binding for ?- _=[F,N], n_factorial(N, F). F = 1, N = 0 ; F = 1, N = 1 ; F = 2, N = 2 ; F = 6, N = 3 ; F = 24, N = 4 ; F = 120, N = 5 ; F = 720, N = 6 ; ... In this way, we can reliably show the most interesting variable bindings first. |
@triska , yes this is one aspect, but more importantly is the actual comparison of different answers containing variables and quite often attached to it, constraints. By having one precise numbering, alternate answers can be much easier compared. Also, I wonder how this different ordering happens anyway, in any case term_variables/2 does not seem to be used for it as this is definitely independent of variable age. |
@mthom: Could |
|
Regardless of the way how a term has been created, new variable names in an answer (-substitution) should always be used in the very same left-to-right order.
The text was updated successfully, but these errors were encountered: