From ok@atlas.otago.ac.nz Fri Apr 27 01:19:39 2001
Received: from atlas.otago.ac.nz (atlas.otago.ac.nz [139.80.32.250])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f3QNJc325031
	for <prolog@swi.psy.uva.nl>; Fri, 27 Apr 2001 01:19:38 +0200 (MET DST)
Received: (from ok@localhost)
	by atlas.otago.ac.nz (8.9.3/8.9.3) id LAA147960;
	Fri, 27 Apr 2001 11:19:24 +1200 (NZST)
Date: Fri, 27 Apr 2001 11:19:24 +1200 (NZST)
From: "Richard A. O'Keefe" <ok@atlas.otago.ac.nz>
Message-Id: <200104262319.LAA147960@atlas.otago.ac.nz>
To: _nicki@aport2000.ru, prolog@swi.psy.uva.nl
Subject: Re:  [SWIPL] Question

_nicki@aport2000.ru> wrote:

	suppose there are function
	
	foo( X ).
	X = a(b(c(d(e(f( Y ))))))     % possibly deeply nested

	and
	foo( Z ).
	Z = something like X, no matter
	
	I try to find an easiest way to unify Z with Y.

What do you actually _mean_ here?


	So, given such argument as X how can I extract Y and replace it with Z.

This is going to sound flip, but that's *your* problem.  What is it about
the subterms of X that lets you find the one that is Y?  Consider the
problem of writing a predicate

    special_subterm(a(b(...(f(Y))...)), Y).

Is Y a variable, or might it, like X, be a complex term?

