Previous Page Next Page Contents

delete -- delete the value of an identifier

Introduction

The statement delete x deletes the value of the identifier x.

Call(s)


delete x1, x2, ... _delete(x1, x2, ...)

Parameters

x1, x2, ... - identifiers or indexed identifiers

Returns

the void object of type DOM_NULL.

Related Functions

:=, _assign, assign, assignElements, evalassign

Details

Example 1

The identifiers x, y are assigned values. After deletion, the identifiers have no values any longer:

>> x := 42: y := 7: delete x: x, y
                                   x, 7
>> delete y: x, y
                                   x, y

More than one identifier can be deleted by one call:

>> a := b := c := 42: a, b, c
                                42, 42, 42
>> delete a, b, c: a, b, c
                                  a, b, c

Example 2

delete can also be used to delete specific elements of lists, arrays, and tables:

>> L := [7, 13, 42]
                                [7, 13, 42]
>> delete L[2]: L
                                  [7, 42]
>> A := array(1..3, [7, 13, 42])
                               +-         -+
                               | 7, 13, 42 |
                               +-         -+
>> delete A[2]: A, A[2]
                           +-           -+
                           | 7, ?[2], 42 |, A[2]
                           +-           -+
>> T := table(1 = 7, 2 = 13, 3 = 42)
                                 table(
                                   3 = 42,
                                   2 = 13,
                                   1 = 7
                                 )
>> delete T[2]: T
                                 table(
                                   3 = 42,
                                   1 = 7
                                 )

Note that delete does not evaluate the objects that are to be deleted. In the following, an element of the list U is deleted. The original value of U (the list L) is not changed:

>> U := L: delete U[1]: U, L
                               [42], [7, 42]

Finally, all assigned values are deleted:

>> delete U, L, A, T: U, L, A, T
                                U, L, A, T

Example 3

delete can also be used to delete properties of identifiers set via assume. With the assumption 'x > 1', the expression ln(x) hat the property 'ln(x) > 0', i.e., its sign is 1:

>> assume(x > 1): sign(ln(x))
                                     1

Without a property of x, the function sign cannot determine the sign of ln(x):

>> delete x: sign(ln(x))
                                sign(ln(x))

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000