prog::find
-- find operands of
expressionsprog::find(
ex, opr)
returns all ``paths''
to the operand opr
in the expression ex
.
prog::find(ex, opr)
ex |
- | any MuPAD expression of type DOM_EXPR |
opr |
- | any MuPAD object |
a list of numbers that determine the position of the given object inside of the given expression, or a sequence of lists, if the expression contains the object several times
prog::find(
ex, obj)
returns the position
of the object obj
in the expression ex
as
list. The list represents a ``path'' to the given object. With this
list and the functions op
and subsop
, the object
can directly be accessed.i1, ...,
in
.
The meaning is that the object is the in
-th operand of
the (in - 1)
-st operand etc. of the i1
-st
operand of the expression ex
.
Stated differently,
.op(ex, [i1, ..., in])
= opr
The identifier a
is the first operand of
the expression:
>> prog::find(a + b + c, a)
[1]
The number 1
occurs several times:
>> prog::find(f(1, 1, 1), 1)
[1], [2], [3]
The identifier a
is the first operand of
the second operand of the first operand of the expression:
>> prog::find(b*(a - 1) + b*(x - 1), a)
[1, 2, 1]
The result of prog::find
can be used to
access the element with op
or replace it with subsop
:
>> op(b*(a - 1) + b*(x - 1), [1, 2, 1]); subsop(b*(a - 1) + b*(x - 1), [1, 2, 1] = A)
a b (A - 1) + b (x - 1)
prog::find
can be used to manipulate complex
MuPAD objects with subsop
.