Re: write_term/2 does not write user specified varnames
Ulrich Neumerkel <[email protected]> Sun, 13 Apr 2014 19:11:02 +0200
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
> 60 ?- T = foo(A, B, A),
> numbervars(T, 0, End, [functor_name('Test')]),
> write_term(T, [numbervars(true)]).
> foo(Test(0),Test(1),Test(0)) <---- Option = true writes terms: NOT OK
> T = foo('Test'(0), 'Test'(1), 'Test'(0)),
> A = 'Test'(0),
> B = 'Test'(1),
> End = 2.
>
> In the last two cases I expected the output "foo(Test0,Test1,Test0)",
> according to http://www.swi-prolog.org/pldoc/man?predicate=write_term/2
> which says that the numbervars(true) option "allows for writing
> variables with user-provided names".
The ISO write-option numbervars/1 takes only terms of the form
'$VAR'(N) as variables. E.g. '$VAR'(0) is written as A.
If you want more elaborate ways of writing variables, consider the
write-option variable_names/1.