System Variable LX: Difference between revisions

From NARS2000
Jump to navigationJump to search
No edit summary
(expanded, added example)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
<h1>{quad}LX - Latent Expression</h1>
<h1>{quad}LX - Latent Expression</h1>
{{BoxStart|<apll>Z←⎕LX</apll>
| user query of <apll>⎕LX</apll> returns the current value of the Latent eXpression or initial workspace startup/load value. }}
{{BoxEnd|Returned by APL's Interpreter: &nbsp; <apll>Z</apll> &nbsp; is a string containing the current value of ⎕LX, and is null if {quad}LX is not defined, i.e. set to


The {quad}LX variable is used within a workspace to set the action to take when the workspace is loaded. Typically it is set to the name of a function in the workspace. {quad}LX defaults to null.
<apll>''</apll>, a null string. <apll>⎕LX</apll>'s value is the command to execute when the workspace is next loaded(after pre-Saving of course) - using )LOAD.}}<br/>


Example usage:
{| border="1" cellpadding="5" cellspacing="0" rules="none" summary=""
:<code> {quad}LX{:=}'Start'</code>
|| <apll>⎕LX←'START'</apll> ||  Have the workspace execute function START when it is loaded via )LOAD or the '''<u>F</u>ile, <u>O</u>pen''' menu
|-
| valign="top" |<apll>⎕LX←''</apll> || Do not have any function execute when the workspace is loaded (null string, this is the default).
|-
|}
<br />


When this workspace is saved, the next time it is loaded, it will attempt to start the function '''Start'''. An error will occur if the function named in {quad}LX is not present when the workspace is loaded.
APL's <apll>{quad}LX</apll> system variable is used within a workspace to set action to take when the workspace is loaded via )LOAD or the '''<u>F</u>ile, <u>O</u>pen'''  


menu. Frequently {quad}LX is set to the name of a function in the workspace. {quad}LX defaults to null.
<br><hr align="center" color="black" size="2" width="58%">
<br><u>'''Sample use #1'''</u> - '''running a startup function''' when workspace is first loaded:
:'''<big><code> {quad}LX{:=}'Start'</code></big>'''
When this workspace is saved, the next time it is loaded through the <big>''')LOAD'''</big> command or the '''<u>F</u>ile, <u>O</u>pen''' menu, it will attempt to start the
function <big>'''Start'''</big>. An error will occur if the function named in <big>'''{quad}LX'''</big> is not present when the workspace is loaded.
The <big>'''{quad}LX'''</big> function is ''not'' executed if the workspace is loaded via the <apll>)XLOAD</apll> command or through the '''<u>F</u>ile, <u>X</u>load'''
menu.
The function of {quad}LX is similar to the function of the AUTOEXEC.BAT file when DOS is started, or when in Windows if you have a shortcut in the Startup Folder in the
Start Menu. The function or action in the {quad}LX system variable is executed before the Session Manager returns control to you.
The action of <big>'''{quad}LX'''</big> when a workspace is <apll>)LOAD</apll>ed is essentially equivalent to typing <big>'''{execute}{quad}LX'''</big> immediately after
loading the workspace.
Note that system commands beginning with a <big>''')'''</big> cannot be executed through <big><b>{quad}LX</b></big>. This is different from the APL Standard, for a reason.
This variation from standard <u>prevents endless loops</u>, such as if a workspace named <big>'''loop'''</big> had a {quad}LX value of <big>''')load loop'''</big>.
<br><hr align="center" color="black" size="2" width="58%">
<br><u>'''Sample use #2'''</u> - '''displaying a user-introductory message using a global variable's value''' when the workspace is loaded:
:'''<big><code> {quad}LX{:=}'⎕←Description'      ⍝ Where Description is a global string variable in either vector or character matrix format.</code></big>'''
<pre>
      Description←'Welcome APL User!  Welcome to NARS, we speak APL here!'
      ⍴Description      ⍝ Query the shape of workspace global variable Description
54
      ⎕LX←'⎕←Description'  ⍝ Notice use of the prompt or quad symbol and assignment arrow in front of the variable's name(⎕←), with APL's entire phrase in quotes.
      ⎕LX              ⍝ Query what is stored in system variable ⎕LX
⎕←Description
      )SAVE            ⍝  Save current workspace
      ...
      ⍝ APL workspace reloaded using )LOAD, startup message shown below:
Welcome APL User!  Welcome to NARS, we speak APL here!
</pre>
The above <apll>⎕LX</apll> examples are helpful, both as workspace reminders <u>and or</u> to help unfamiliar users quickly get started using that particular APL workspace.  If you were last editing a function just before )OFF, you can remind yourself where you were at, for example after a long week-end or you were in a complex debug situation. See also [[System_Command_SI|State Indicator - system command )SI]].
<br><hr align="center" color="gray" size="2" width="65%">
==See Also==
* [[System Command LOAD|)LOAD]]
* [[System Command SAVE|)SAVE]]
* [[System Command XLOAD|)XLOAD]]


{{System Variables}}
{{System Variables}}
{{Article footer}}

Latest revision as of 13:09, 15 July 2015

⎕LX - Latent Expression

Z←⎕LX user query of ⎕LX returns the current value of the Latent eXpression or initial workspace startup/load value.
Returned by APL's Interpreter:   Z   is a string containing the current value of ⎕LX, and is null if ⎕LX is not defined, i.e. set to '', a null string. ⎕LX's value is the command to execute when the workspace is next loaded(after pre-Saving of course) - using )LOAD.


⎕LX←'START' Have the workspace execute function START when it is loaded via )LOAD or the File, Open menu
⎕LX←'' Do not have any function execute when the workspace is loaded (null string, this is the default).


APL's ⎕LX system variable is used within a workspace to set action to take when the workspace is loaded via )LOAD or the File, Open

menu. Frequently ⎕LX is set to the name of a function in the workspace. ⎕LX defaults to null.




Sample use #1 - running a startup function when workspace is first loaded:

⎕LX←'Start'

When this workspace is saved, the next time it is loaded through the )LOAD command or the File, Open menu, it will attempt to start the

function Start. An error will occur if the function named in ⎕LX is not present when the workspace is loaded.

The ⎕LX function is not executed if the workspace is loaded via the )XLOAD command or through the File, Xload

menu.

The function of ⎕LX is similar to the function of the AUTOEXEC.BAT file when DOS is started, or when in Windows if you have a shortcut in the Startup Folder in the

Start Menu. The function or action in the ⎕LX system variable is executed before the Session Manager returns control to you.

The action of ⎕LX when a workspace is )LOADed is essentially equivalent to typing ⍎⎕LX immediately after

loading the workspace.

Note that system commands beginning with a ) cannot be executed through ⎕LX. This is different from the APL Standard, for a reason.

This variation from standard prevents endless loops, such as if a workspace named loop had a ⎕LX value of )load loop.




Sample use #2 - displaying a user-introductory message using a global variable's value when the workspace is loaded:

⎕LX←'⎕←Description' ⍝ Where Description is a global string variable in either vector or character matrix format.
      Description←'Welcome APL User!  Welcome to NARS, we speak APL here!'
      ⍴Description      ⍝ Query the shape of workspace global variable Description
54
      ⎕LX←'⎕←Description'   ⍝ Notice use of the prompt or quad symbol and assignment arrow in front of the variable's name(⎕←), with APL's entire phrase in quotes.
      ⎕LX              ⍝ Query what is stored in system variable ⎕LX
⎕←Description
      )SAVE            ⍝  Save current workspace

      ...
      ⍝ APL workspace reloaded using )LOAD, startup message shown below:


Welcome APL User!  Welcome to NARS, we speak APL here!

The above ⎕LX examples are helpful, both as workspace reminders and or to help unfamiliar users quickly get started using that particular APL workspace. If you were last editing a function just before )OFF, you can remind yourself where you were at, for example after a long week-end or you were in a complex debug situation. See also State Indicator - system command )SI.



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


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

[[Category:Mouse Group {{{1}}}|{{{2}}}]]