Hi Ulrich,
Rest assured, there is no problem with allowing
the Prolog processor to make a variable name choice.
This is anyway an option that is mostly needed
in the top-level. You can of course also use it
to list clauses in listing/[0,1] and friends. But
so far I havent seen a problem over the last years.
If you see a problem, please document it.
I also did some checks today about term expansion.
Term expansion hardly does A=B, and if it does, it
doesn't impact the result in any significant way.
If you see a problem, please document it.
I made this test just right now. I don't see any
problems whatever. Works on my side, I am using
variable_names/1 in my listing/[0,1]:
Jekejeke Prolog 2, Runtime Library 1.2.6
(c) 1985-2018, XLOG Technologies GmbH, Switzerland
?- [user].
q --> [X,X].
Yes
?- listing.
% user
q([X,X|A], A).
Yes
Unfortunately variable name listing/[0,1] works not
yet completely for SWI-Prolog. They announced something,
but it does not yet work in their top-level.
Welcome to SWI-Prolog (threaded, 64 bits, version 7.7.15)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
?- [user].
|: q --> [X,X].
|:
% user://1 compiled 0.00 sec, 1 clauses
true.
?- listing(q/2).
q([A, A|B], B).
true.
The reason is SWI-Prolog has variable_names/1, but
they do not yet use it anywhere. You can check their
code. I checked it last year, it wasnt used anywhere.
But you can test SWI-Prolog, a Prolog system which so
far has ignored all your variable_names/1 efforts in
listing/[0,1] itself, this way:
Welcome to SWI-Prolog (threaded, 64 bits, version 7.7.15)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
?- T=(q-->[X,X]), write_term(T,[variable_names(['X'=X])]), nl.
q-->[X,X]
?- T1=(q-->[X,X]), expand_term(T1,T),
write_term(T, [variable_names(['X'=X])]), nl.
q([X,X|_1166],_1166):-true
And again works also on my side. I demonstrated already
through listing/[0,1], but just in case you don't believe me:
Jekejeke Prolog 2, Runtime Library 1.2.6
(c) 1985-2018, XLOG Technologies GmbH, Switzerland
?- T=(q-->[X,X]),
write_term(T,[variable_names(['X'=X])]), nl.
q-->[X,X]
?- T1=(q-->[X,X]), expand_term(T1,T), write_term(T,
[variable_names(['X'=X])]), nl.
q([X,X|_D],_D):-true
Am Samstag, 2. Juni 2018 16:19:46 UTC+2 schrieb Ulrich Neumerkel: