manual:chapter6:operators:cmd_ovr_istrue


Synopsis


Test if an object differs from the null element of its type

Stack Diagram


Input Stack Output Stack
O 1/0
Level 1 / Argument 1 Level 1

Legend

Type Operator
Parallel list processing Group 2
Affected by flags None

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)' FIXME
Symbolic expression 'ISTRUE(expression)' FIXME
Grob No null element. ISTRUE always returns 1
Font No null element. ISTRUE always returns 1 FIXME
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 FIXME

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


Overloadable operators 26 3 NEW

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
  • manual/chapter6/operators/cmd_ovr_istrue.txt
  • Last modified: 2019/11/03 15:02
  • by jojo1973