Previous Page Next Page Contents

evalassign -- assignment with evaluation of the left hand side

Introduction

evalassign(x, value, i) evaluates x with substitution depth i and assigns value to the result of the evaluation.

Call(s)

evalassign(x, value, i)
evalassign(x, value)

Parameters

x - an object that evaluates to a valid left hand side of an assignment
value - any MuPAD object
i - a nonnegative integer less than 2^31

Returns

value.

Related Functions

:=, _assign, assign, assignElements, delete, eval, LEVEL, level

Details

Example 1

evalassign can be used in situations such as the following. Suppose that an identifier a has another identifier b as its value, and that we want to assign something to this value of a, not to a itself:

>> delete a, b: a := b:
   evalassign(a, 100, 1): level(a, 1), a, b
                                b, 100, 100

This would not have worked with the assignment operator :=, which does not evaluate its left hand side:

>> delete a, b: a := b:
   a := 100: level(a, 1), a, b
                                100, 100, b

Example 2

The second argument may also be a sequence:

>> a := b:
   evalassign(a, (3,5), 1):
   b
                                   3, 5

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000