From jan@swi.psy.uva.nl Mon Mar 26 10:08:01 2001
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f2Q881328716;
	Mon, 26 Mar 2001 10:08:01 +0200 (MET DST)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) id f2Q880703800;
	Mon, 26 Mar 2001 10:08:00 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: Ralf Laemmel <Ralf.Laemmel@cwi.nl>
Subject: Re: goal_expansion/2
Date: Mon, 26 Mar 2001 09:53:48 +0200
X-Mailer: KMail [version 1.0.29.2]
Content-Type: text/plain
References: <199911281354.OAA05891@gollem.swi.psy.uva.nl> <3ABE6770.D22B6D00@cwi.nl>
In-Reply-To: <3ABE6770.D22B6D00@cwi.nl>
Cc: prolog@gollem.swi.psy.uva.nl
MIME-Version: 1.0
Message-Id: <01032610080000.03679@gollem>
Content-Transfer-Encoding: 8bit

On Sun, 25 Mar 2001, you wrote:
>Dear Jan,
>
>what is the deeper reason that goal_expansion/2
>is applied repeatedly (as long as it triggers)?
>I mean suppose I want to replace a by a,nl, should
>I use something else for that purpose (so that
>expansion will not loop)?

If you write

goal_expansion(x, w).
goal_expansion(z, (x,y)).

you get the expected (w, y) for z.  Otherwise you'd
had to write:

goal_expansion(z, (X, Y)) :-
	expand_goal(x, X),
	expand_goal(y, Y).

Agreed the expansion you want is hard to realise, in
fact the only way would be to define another version
of goal-expansion using term_expansion.

The current behaviour however is consistent to SICStus,
which also goes into a loop expansing a to a,nl.

	--- Jan

