Previous Page Next Page Contents

null -- generate the void object of type DOM_NULL

Introduction

null() returns the void object of domain type DOM_NULL.

Call(s)

null()

Returns

the void object of domain type DOM_NULL.

Related Functions

_exprseq, _stmtseq, FAIL, NIL

Details

Example 1

null() returns the void object which does not produce any screen output:

>> null()
     

The resulting object is of domain type DOM_NULL:

>> domtype(null())
                                 DOM_NULL

This object represents the empty expression sequence and the empty statement sequence:

>> domtype(_exprseq()), domtype(_stmtseq())
                            DOM_NULL, DOM_NULL

Some system functions such as print return the void object:

>> print("Hello world!"):
                              "Hello world!"
>> domtype(%)
                                 DOM_NULL

Example 2

The void object is removed from lists, sets, and expression sequences:

>> [null(), a, b, null(), c], {null(), a, b, null(), c}, 
   f(null(), a, b, null(), c)
                     [a, b, c], {a, b, c}, f(a, b, c)
>> a + null() + b = _plus(a, null(), b)
                               a + b = a + b
>> subsop([a, x, b], 2 = null()), subs({a, x, b}, x = null())
                              [a, b], {a, b}

However, null() is a valid entry in arrays and tables:

>> a := array(1..2): a[1] := 1: a[2] := null(): a
                               +-         -+
                               | 1, null() |
                               +-         -+
>> domtype(a[1]), domtype(a[2])
                             DOM_INT, DOM_NULL
>> t := table(null() = "void", 1 = 2.5, b = null())
                             table(
                               b = null(),
                               1 = 2.5,
                               null() = "void"
                             )
>> domtype(t[b]), t[]
                             DOM_NULL, "void"
>> delete a, t:

Example 3

The void object remains if you delete all elements from an expression sequence:

>> a := (1, b): delete a[1]: delete a[1]: domtype(a)
                                 DOM_NULL

The operand function op returns the void object when applied to an object with no operands:

>> domtype(op([])), domtype(op({})), domtype(op(f()))
                       DOM_NULL, DOM_NULL, DOM_NULL
>> delete a:

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000