Subject: Re: [SWIPL] Question

From: "Richard A. O'Keefe" <[email-masked]>
Date: Fri, 27 Apr 2001 11:19:24 +1200 (NZST)

[email-masked]> 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?