From lourens@cs.vu.nl  Tue Aug 29 15:30:03 2000
Received: from fluit.cs.vu.nl (root@fluit.cs.vu.nl [192.31.231.67])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id PAA11436
	for <prolog@swi.psy.uva.nl>; Tue, 29 Aug 2000 15:30:03 +0200 (MET DST)
Received: from localhost by fluit.cs.vu.nl with esmtp
	(Smail #65) id m13TlSp-001IzoC; Tue, 29 Aug 2000 15:30 +0200
Date: Tue, 29 Aug 2000 15:30:06 +0200 (CEST)
From: Lourens van der Meij <lourens@cs.vu.nl>
To: prolog@swi.psy.uva.nl
Subject: write_term(Term, [variable_names(Vars)])  ?
Message-ID: <Pine.GSO.4.21.0008291527430.10108-100000@fluit.cs.vu.nl>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII




I could not find a write predicate in SWI-Prolog that writes terms such
that a variable Var occurring in the term is replaced by Name if there is
an entry Name = Var in a supplied Vars list,  complementary to
read_term(Term,[variable_names(Vars)]).
 
Is there such a write predicate or write option in SWI-Prolog?

If not, I suppose I could use write_term by first binding all variables in
a 'Name=Var'-list:

1)	Var = '$NAME'(Name) for each entry Name = Var in'Name=Var'-list 

2) 	define a portray hook for'$NAME'(Name) 
		user:portray($NAME'(Name)) :- 
			write_term(Name, [quoted(false)]).
3)	use write_term with portray(true)?

However I don't find this an elegant solutionn.

Jan, if there is no such write predicate in SWI-prolog yet, is it possible
to add such a complementary variable_names/1 option to the write_term/[2,3] 
predicate?



A minor remark on write_term in SWI-Prolog:

?- write_term(aap(P,Q,f(P)),[variable_names(['P'=P,'Q'=Q]),noot]).
aap(_G510, _G513, f(_G510))

P = _G510
Q = _G513 

There is no error message for an undefined option in
write_term[2,3] in SWI-Prolog(3.3.9).


Lourens

(lourens@cs.vu.nl)








