Scalar System Variables: Difference between revisions

From NARS2000
Jump to navigationJump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<p>The Scalar System Variables (<apll>⎕CT</apll>, <apll>⎕IO</apll>, <apll>⎕FPC</apll>, <apll>⎕PP</apll>, <apll>⎕PW</apll>, and <apll>⎕RL</apll>) when assigned to (<apll>⎕PP←R</apll>), have two properties beyond the ones in their description in the Extended APL Standard.</p>
<p>The System Variables (<apll>⎕CT</apll>, <apll>⎕DT</apll>, <apll>⎕FPC</apll>, <apll>⎕IC</apll>, <apll>⎕IO</apll>, <apll>⎕PP</apll>, <apll>⎕PW</apll>, and <apll>⎕RL</apll>) when assigned to (<apll>⎕FPC←R</apll>), have two properties beyond the ones in their description in the Extended APL Standard.</p>


<ul>
<ul>
   <li><p>If a number to be assigned to any of the scalar system variables is out of the normal range for that variable, it is automatically range-limited, meaning if the number is too high, the highest valid number is used, if it is too low, the lowest valid number is used, and if the input is fractional and the normal range is integral, the ceiling of the input is used and then limited at the top or bottom as necessary.  This way, you don't need to know the limits of a scalar system variable, and won't signal a <apll>DOMAIN ERROR</apll> by using a value out of range.</p>
   <li><p>If a number to be assigned to any of the above system variables is out of the normal range for that variable, it is automatically range-limited, meaning if the number is too high, the highest valid number is used, if it is too low, the lowest valid number is used, and if the input is fractional and the normal range is integral, the ceiling of the input is used and then limited at the top or bottom as necessary.  This way, you don't need to know the limits of a scalar system variable, and won't signal a <apll>DOMAIN ERROR</apll> by using a value out of range.</p>


<p>For example,</p>
<p>For example,</p>


<apll>
<apll>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕PP←33.3<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕FPC←33.3<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕PP<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕FPC<br />
17<br />
53<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕CT←¯2<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕CT←¯2<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕CT<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕CT<br />
Line 16: Line 16:
</li>
</li>


<li><p>If an empty simple vector is assigned to any of the scalar system variables, the default system value is used instead.  This way, you can restore the default value without knowing its value.</p>
<li><p>If an empty simple vector is assigned to any of the above system variables, the default system value is used instead.  This way, you can restore the default value without knowing its value.</p>


<p>For example,</p>
<p>For example,</p>
Line 26: Line 26:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕CT←''<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕CT←''<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕CT<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕CT<br />
3.0E¯15<br />
3E¯15<br />
</apll>
</apll>
</li>
</li>

Latest revision as of 11:32, 26 May 2013

The System Variables (⎕CT, ⎕DT, ⎕FPC, ⎕IC, ⎕IO, ⎕PP, ⎕PW, and ⎕RL) when assigned to (⎕FPC←R), have two properties beyond the ones in their description in the Extended APL Standard.

  • If a number to be assigned to any of the above system variables is out of the normal range for that variable, it is automatically range-limited, meaning if the number is too high, the highest valid number is used, if it is too low, the lowest valid number is used, and if the input is fractional and the normal range is integral, the ceiling of the input is used and then limited at the top or bottom as necessary. This way, you don't need to know the limits of a scalar system variable, and won't signal a DOMAIN ERROR by using a value out of range.

    For example,

         ⎕FPC←33.3
         ⎕FPC
    53
         ⎕CT←¯2
         ⎕CT
    0

  • If an empty simple vector is assigned to any of the above system variables, the default system value is used instead. This way, you can restore the default value without knowing its value.

    For example,

         ⎕PP←⍬
         ⎕PP
    10
         ⎕CT←''
         ⎕CT
    3E¯15

See Also

System Variables (A value may be assigned to these except for ⎕DM)
ALX CT DM DT ELX FC FEATURE FPC IC IO
LR LX PP PR PW RL SA WSID
Niladic System Functions (a value cannot be assigned to these)
A AV EM ET LC NNAMES NNUMS SI SYSID SYSVER
T TC TCBEL TCBS TCESC TCFF TCHT TCLF TCNL TCNUL
TS WA
Monadic or dyadic system functions (a value cannot be assigned to these)
AT CR DC DFT DL DR EA EC ERROR ES
EX FMT FX MF NAPPEND NC NCREATE NERASE NINFO NL
NLOCK NREAD NRENAME NREPLACE NRESIZE NSIZE NTIE NUNTIE STOP TF
TRACE UCS VR
Note that quad functions and variables (except for the ⎕A family of functions) are case insensitive