System Function FX: Difference between revisions

From NARS2000
Jump to navigationJump to search
(Created Quad FX page)
 
Line 60: Line 60:
     <table border="0" cellpadding="5" cellspacing="0" summary="">
     <table border="0" cellpadding="5" cellspacing="0" summary="">
     <tr>
     <tr>
       <td valign="top"><apll>Z←L ⎕FX R</apll></td>
       <td valign="top"><apll>Z←L ⎕FX R</apll>&nbsp;&nbsp;&nbsp;Fix a function and Set its function timestamp</td>
       <td>Right argument R is the same as the monadic call</td>
    </tr>
       <td>Left argument L is a boolean vector with 1=turn ON property, 0=turn OFF property</td>
    <tr>
       <td>Not yet fully documented, awaiting full documentation.</td>
       <td><apll>R</apll> is the same as in the monadic call</td>
    </tr>
    <tr>
       <td><apll>L</apll> is a 7-element numeric vector which contains the new timestamp &mdash; the format is the same as for <apll>⎕TS</apll>.</td>
    </tr>
    <tr>
       <td><apll>Z</apll> is the result of fixing the function as described in the monadic case.
     </tr>
     </tr>
     </table>
     </table>
Line 69: Line 75:
</tr>
</tr>
</table>
</table>
Sample Output Function Properties(to potentially or hypothetically switch on/off):<br>
<br />
<u>'''Function'''</u>:<br>
The dyadic version of this System Function first fixes the function as per <apll>R</apll>.  If that is successful, it then changes the timestamp to that of <apll>L</apll>.  If the User Preference '''Use local time (instead of UTC)''' is checked, the timestamp in <apll>L</apll> is assumed to be in Local Time; otherwise, the timestamp is assumed to be in UTC.  The time stored internal to the function is always in UTC.
* Can/Cannot be displayed - viewed
 
* Can/Cannot be suspended - halted
If <apll>L</apll> is not valid, the appropriate error is signaled.
* Does/does Not ignore attention signal(e.g. Ctrl-C or Ctrl-Break)
 
* Converts ANY nonresource error to DOMAIN ERROR
<p>For example:</p>
* Can/Cannot be modified/locked
 
'''Quad FX''' sample ''dyadic'' usage: not yet documented.
<apll><pre>
      ⎕←⎕FX 'Z←L g R' 'Z←L,R'
g
      2 ⎕AT 'g'
2017 6 3 15 58 59 104
      ⎕←(⎕TS+7↑1) ⎕FX 'Z←L g R' 'Z←L,R'
g
      2 ⎕AT 'g'
2018 6 3 15 59 5 593
</pre></apll>


{{SFDM|FX}}
{{SFDM|FX}}

Revision as of 20:54, 3 June 2017

Quad FX - FIX or Function eXecute - ⎕FX     System Function

Monadic Function

No Execution Properties (no special properties in the output function established/fixed)

Z←⎕FX R
R is either a character matrix OR a vector of strings for a function's representation in character matrix or string form.
Z returned will be the function name OR the line number of the function which failed to be established in the workspace.


Quad FX FIX sample monadic use/user session(with comments at right):

      )FNS              ⍝ In a CLEAR NARS APL workspace there are NOT YET any functions
      ⎕NL 3            ⍝ Similarly, Quad Name List will show NO user functions
      ⍴⎕NL 3
0 0
      X←'Z←Total vecNums' 'Z←+/vecNums' '"The Total is: ",Z'  ⍝Var X is assigned 3 vectorized strings for a NEW funct.
      X          ⍝ X has 3 elements, 1) function header, 2) APL code statement #1, 3) APL code statement #2
 Z←Total vecNums Z←+/vecNums "The Total is: ",Z 
      ⎕FX X           ⍝ Here variable X is attempted to be Function eXecuted or FIXed into a NEW function
Total                 ⍝ ⎕FX or FIX attempt SUCCEEDED and APL returns the Function NAME(Total)
      Total ⍳5         ⍝ The first "use" of function Total attempts to Total 5 numbers(iota 5), 1+2+3+4+5
The Total is:  15
15
      )FNS            ⍝ Now a list of functions in the workspace shows function 'Total' exists
Total 
      ⎕VR 'Total'    ⍝ Request function Total's Virtual Representation (1 header row plus 2 APL statement rows)
    ∇ Z←Total vecNums
[1]   Z←+/vecNums
[2]   "The Total is: ",Z
    ∇ 2015 2 15 4 38 9 863 (UTC)

When is ⎕FX useful?

  • You are using a different function editor than the one supplied with NARS and need to re-establish or fix the function into the workspace.
  • You have read in an APL function into APL from a different APL software package OR outside source, and need to make the function read-in active in the current workspace.
  • Your program has automatically created a function in string form, on the fly, and you need to make it active.
  • You have external libraries of APL functions and only want to use them as needed, thus you read in the file and FIX the functions, then use them.

Dyadic Function

WITH Execution Properties

Z←L ⎕FX R   Fix a function and Set its function timestamp
R is the same as in the monadic call
L is a 7-element numeric vector which contains the new timestamp — the format is the same as for ⎕TS.
Z is the result of fixing the function as described in the monadic case.


The dyadic version of this System Function first fixes the function as per R. If that is successful, it then changes the timestamp to that of L. If the User Preference Use local time (instead of UTC) is checked, the timestamp in L is assumed to be in Local Time; otherwise, the timestamp is assumed to be in UTC. The time stored internal to the function is always in UTC.

If L is not valid, the appropriate error is signaled.

For example:

      ⎕←⎕FX 'Z←L g R' 'Z←L,R'
g
      2 ⎕AT 'g'
2017 6 3 15 58 59 104 
      ⎕←(⎕TS+7↑1) ⎕FX 'Z←L g R' 'Z←L,R'
g
      2 ⎕AT 'g'
2018 6 3 15 59 5 593 


Note: ⎕FX is available as both a monadic and dyadic 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
A+S
Alt ¨ ¯ < > × ÷
Sh ~ ! @ # $ % ^ & * ( ) _ +
Key ` 1 2 3 4 5 6 7 8 9 0 - =
A+S
Alt ? § π
Sh Q W E R T Y U I O P { } |
Key q w e r t y u i o p [ ] \
A+S
Alt
Sh A S D F G H J K L : "
Key a s d f g h j k l ; '
A+S χ
Alt
Sh 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