System Function SI: Difference between revisions

From NARS2000
Jump to navigationJump to search
(Created page with "<h1><apl>⎕SI</apl> - State Indicator</h1> <apll>⎕SI</apll> is a niladic system function which returns a character matrix of the functions and their line numbers currently...")
 
No edit summary
 
Line 1: Line 1:
<h1><apl>⎕SI</apl> - State Indicator</h1>
<h1><aplxx>⎕SI</aplxx> - State Indicator</h1>


<apll>⎕SI</apll> is a niladic system function which returns a character matrix of the functions and their line numbers currently being executed. Consider the following functions:
<apll>⎕SI</apll> is a niladic system function which returns a character matrix of the functions and their line numbers currently being executed. Consider the following functions:
Line 55: Line 55:
In this example, <apll>⎕SI</apll> is displayed on <apll>test2[2]</apll>, and '''test1''' is called on <apll>test2[3]</apll>.  In turn, '''test1''' calls <apll>⎕SI</apll> on <apll>test1[2]</apll> and suspends on <apll>test1[4]</apll>, all of which is reflected in the output of <apll>⎕SI</apll> at each level.
In this example, <apll>⎕SI</apll> is displayed on <apll>test2[2]</apll>, and '''test1''' is called on <apll>test2[3]</apll>.  In turn, '''test1''' calls <apll>⎕SI</apll> on <apll>test1[2]</apll> and suspends on <apll>test1[4]</apll>, all of which is reflected in the output of <apll>⎕SI</apll> at each level.


== Special Rows In <apll>⎕SI</apll> ==
== Special Rows In <aplx>⎕SI</aplx> ==


Note that a row in the result of <apll>⎕SI</apll> might represent Quad input, the Execute function, and/or a Magic Function.  These rows are identified by a leading <apll>⎕</apll>, <apll>⍎</apll>, and <apll>#</apll>, respectively.  After these rows are removed from <apll>⎕SI</apll>, the remaining rows match up one-to-one with the elements of <apll>⎕LC</apll>.
Note that a row in the result of <apll>⎕SI</apll> might represent Quad input, the Execute function, and/or a Magic Function.  These rows are identified by a leading <apll>⎕</apll>, <apll>⍎</apll>, and <apll>#</apll>, respectively.  After these rows are removed from <apll>⎕SI</apll>, the remaining rows match up one-to-one with the elements of <apll>⎕LC</apll>.


{{SFN|SI}}
{{SFN|SI}}

Latest revision as of 11:05, 16 April 2018

⎕SI - State Indicator

⎕SI is a niladic system function which returns a character matrix of the functions and their line numbers currently being executed. Consider the following functions:

    ∇ test1
[1]   'Inside test1'
[2]   'SI=' ⎕SI
[3]   
[4]   +
    ∇

    ∇ test2
[1]   'Inside test2, calling test1'
[2]   'SI=' ⎕SI
[3]   test1
    ∇

Calling test1 produces the following output:

      test1
Inside test1
 SI=  test1[2]   
SYNTAX ERROR
test1[4] +
         ∧
      ⎕SI
test1[4] *

In this example, ⎕SI is displayed on test1[2], after which the function is suspended on test1[4] as indicated by the trailing asterisk.

Calling test2 with test1 still suspended produces the following output:

      test2
Inside test2, calling test1
 SI=  test2[2]   
      test1[4] * 
Inside test1
 SI=  test1[2]   
      test2[3]   
      test1[4] * 
SYNTAX ERROR
test1[4] +
         ∧
      ⎕SI
test1[4] *
test2[3]  
test1[4] *

In this example, ⎕SI is displayed on test2[2], and test1 is called on test2[3]. In turn, test1 calls ⎕SI on test1[2] and suspends on test1[4], all of which is reflected in the output of ⎕SI at each level.

Special Rows In ⎕SI

Note that a row in the result of ⎕SI might represent Quad input, the Execute function, and/or a Magic Function. These rows are identified by a leading , , and #, respectively. After these rows are removed from ⎕SI, the remaining rows match up one-to-one with the elements of ⎕LC.


Note: SI is a niladic form system function, you cannot assign a value to it.

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


See Also
System Commands System Variables and Functions Operators


Keyboard
Alt+Shift
Alt ¨ ¯ < > × ÷
Shift ~ ! @ # $ % ^ & * ( ) _ +
Key ` 1 2 3 4 5 6 7 8 9 0 - =
Alt+Shift
Alt ? § π
Shift Q W E R T Y U I O P { } |
Key q w e r t y u i o p [ ] \
Alt+Shift
Alt
Shift A S D F G H J K L : "
Key a s d f g h j k l ; '
Alt+Shift χ
Alt
Shift Z X C V B N M < > ?
Key z x c v b n m , . /
NARS 2000 Lang
Tool
Bar
+ - × ÷ * ! ? |
< = >
~ § π .. ,
/ \ ¨ .
_ ¯
Second Row i j k i j k l g p r v x