aboutsummaryrefslogtreecommitdiff
path: root/pkg/language/doc/isindef.hlp
blob: 481d9cc0e2951f61781d4dc3ea185886f1853622 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
.help isindef Dec03 language
.ih
NAME
isindef -- test whether a value or expression is INDEF
.ih
USAGE
bool = isindef (expr)
.ih 
PARAMETERS
.ls expr
A script variable or boolean expression.
.le
.ih
DESCRIPTION
\fIIsindef\fR is a boolean intrinsic function returning true ("yes") if the
\fIexpr\fR evaluates to INDEF, and false ("no") otherwise.  When \fIexpr\fR
is a script variable or the literal string "INDEF" this function is equivalent
to a test for equality with INDEF, i.e. "x == INDEF".  A less obvious use
is when INDEF values are used to test for less/greater-than evaluation
in boolean expressions which result in an INDEF value for the expression as a
whole (rather than a boolean return) and which can cause confusion about why
the expression apparently fails.  INDEF values in scripts may only be used to
test for equality, otherwise the return value is indefinite and when used in
a compound expression the entire expression is also indefinite.  The
\fIisindef\fR function provides a way to trap such cases in scripts.  

\fIIsindef\fR can only be called as a function in an expression, not as a task.
.ih
EXAMPLES
1. Test variables for INDEF values:

.nf
    cl> x = INDEF
    cl> = (x == INDEF)
    yes
    cl> = isindef (x)
    yes
    cl> = isindef (x == INDEF)
    no

        \fINote:\fR  In this last case the function returns a 'no' since
        the evaluation of "x == INDEF" is 'yes' and not 'INDEF'.

    cl> = isindef (x == INDEF || x < 0)
    yes

        \fINote:\fR  In this case the test "x < 0" is indefinite and 
	causes the entire expression to evaluate to INDEF, and so the
	function returns 'yes' even though the first expression is a
	valid boolean.
.fi
.ih
BUGS
.endhelp
.ih
SEE ALSO