Show pageDiscussionOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ==== ISTRUE ==== ---- <callout type="primary" color="" icon="fa fa-book" title="Synopsis"> ---- Test if an object differs from the null element of its type </callout> <callout color="green" icon="fa fa-indent" title="Stack Diagram"> ---- ^ __Input Stack__ ^ ^ __Output Stack__ ^ | **O** | **→** | **1/0** | | //Level 1 / Argument 1// | //→// | //Level 1// | {{page>manual:chapter6:aux:legend&nofooter&noeditbtn&inline}} |**Type**| [[manual:chapter5:basics#operators|Operator]] || |**Parallel list processing**| [[manual:chapter5:listproc#group-2commands-that-must-use-dolist-to-parallel-process|Group 2]] || |**Affected by flags**| None || </callout> <callout color="orangered" icon="fa fa-comment" title="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 ^ | [[manual:chapter3:reals#approximate-versus-exact|Real]], [[manual:chapter3:reals#approximate-versus-exact|Integer]] or [[manual:chapter3:reals#numbers-in-other-bases|Binary number]] | ''0'' / ''#0b'' / ''#0o'' / ''#0h'' | | [[manual:chapter3:complex|Complex number]] | ''(0,0)'' / ''(0,∡0°)'' / ''(0,∡0r)'' / ''(0,∡0g)'' / ''(0,∡0d)'' | | [[manual:chapter3:angles|Angle]] | ''∡0°'' / ''∡0r'' / ''∡0g'' / ''∡0d'' | | [[manual:chapter3:strings|String]] | ''""'' | | [[manual:chapter3:lists|List]] | ''{ }'' | | [[manual:chapter3:matrix|Vector]] or [[manual:chapter3:matrix|Matrix]] | A vector or a matrix where ''ISTRUE'' returns ''0'' for each element | | [[manual:chapter3:units|Unit]] | A unit object with numerical part equal to ''0'' | | [[manual:chapter4:dirs#variable-storage|Identifier]] | ''%%'%%ISTRUE(identifier)%%'%%'' FIXME | | [[manual:chapter3:symbolic|Symbolic expression]] | ''%%'%%ISTRUE(expression)%%'%%'' FIXME | | [[manual:chapter3:grobs|Grob]] | No null element. ''ISTRUE'' always returns ''1'' | | [[manual:chapter3:fonts|Font]] | No null element. ''ISTRUE'' always returns ''1'' FIXME | | [[manual:chapter3:bindata|Binary data container]] | No null element. ''ISTRUE'' always returns ''1'' | | [[manual:chapter4:dirs#directories|Directory]] | No null element. ''ISTRUE'' always returns ''1'' | | [[manual:chapter4:libs|Library]] | No null element. ''ISTRUE'' always returns ''1'' | | [[manual:chapter5|Program]] | Program gets ''[[manual:chapter6:operators:cmd_ovr_xeq|XEQ]]''%%'%%ted and result is fed to ''ISTRUE'' FIXME | </callout> <callout type="danger" icon="true" title="Compatibility"> ---- This command is new in newRPL and does not exist in userRPL. </callout> <callout type="info" icon="true" title="Usage"> ---- <code> 1: [ [ 0 0 ] [ 0 1 ] ] …………………………………………………………………………………… ISTRUE </code> will result in <code> 1: 1 …………………………………………………………………………………… </code> ---- <code> 1: [ [ 0 0 ] [ 0 0 ] ] …………………………………………………………………………………… ISTRUE </code> will result in <code> 1: 0 …………………………………………………………………………………… </code> </callout> <callout color="darkgray" icon="fa fa-hand-o-right" title="Related Commands"> ---- {{page>manual:chapter6:operators&nofooter&noeditbtn&inline}} </callout> manual/chapter6/operators/cmd_ovr_istrue.txt Last modified: 2019/11/03 15:02by jojo1973