ISTRUE
Synopsis
Test if an object differs from the null element of its type
Description
The ISTRUE operator tests implicitly the object on level 1 against the null element of its type and returns 1 if it differs or 0 otherwise. For each type, the null element is defined as follows:
| Type | Null Element |
|---|---|
| Real, Integer or Binary number | 0 / #0b / #0o / #0h |
| Complex number | (0,0) / (0,∡0°) / (0,∡0r) / (0,∡0g) / (0,∡0d) |
| Angle | ∡0° / ∡0r / ∡0g / ∡0d |
| String | “” |
| List | { } |
| Vector or Matrix | A vector or a matrix where ISTRUE returns 0 for each element |
| Unit | A unit object with numerical part equal to 0 |
| Identifier | 'ISTRUE(identifier)' |
| Symbolic expression | 'ISTRUE(expression)' |
| Grob | No null element. ISTRUE always returns 1 |
| Font | No null element. ISTRUE always returns 1 |
| Binary data container | No null element. ISTRUE always returns 1 |
| Directory | No null element. ISTRUE always returns 1 |
| Library | No null element. ISTRUE always returns 1 |
| Program | Program gets XEQ'ted and result is fed to ISTRUE |
Compatibility
This command is new in newRPL and does not exist in userRPL.
Usage
1: [ [ 0 0 ] [ 0 1 ] ] …………………………………………………………………………………… ISTRUE
will result in
1: 1 ……………………………………………………………………………………
1: [ [ 0 0 ] [ 0 0 ] ] …………………………………………………………………………………… ISTRUE
will result in
1: 0 ……………………………………………………………………………………
Related Commands
| Operator | Short Description | |
|---|---|---|
| Evaluation operators: | ||
| EVAL1 | Evaluate one level | NEW |
| EVAL | Evaluate full depth | |
| XEQ | Execute | NEW |
| →NUM | Compute numeric result | |
| Test operators: | ||
| == | Equality test | |
| ≠ | Not equal test | |
| < | Less than test | |
| ≤ | Less than or equal test | |
| > | Greater than test | |
| ≥ | Greater than or equal test | |
| CMP | Comparison test (<0 if A<B, 0 if A==B, >0 if A>B) | NEW |
| SAME | Comparison test, true if objects are the same | |
| ISTRUE | True test | NEW |
| Logical operators: | ||
| AND | Logical AND | |
| OR | Logical OR | |
| XOR | Logical XOR | |
| NOT | Logical NOT | |
| Mathematic operators: | ||
| + | Addition | |
| - | Subtraction | |
| * | Multiplication | |
| / | Division | |
| ^ | Power | |
| XROOT | Root | |
| INV | Inverse | |
| NEG | Negate/change sign | |
| ABS | Magnitude or absolute value | |