System Variable FEATURE: Difference between revisions
No edit summary |
Sudleyplace (talk | contribs) No edit summary |
||
Line 9: | Line 9: | ||
| valign="top" |<apll>⎕FEAURE←⍬</apll> || sets all of the values of the Feature Control vector to their system default state. | | valign="top" |<apll>⎕FEAURE←⍬</apll> || sets all of the values of the Feature Control vector to their system default state. | ||
|- | |- | ||
|| <apll>⎕FEATURE[L]←R</apll> || sets the value(s) of the Feature Control vector indexed by <apll>L</apll> to <apll>R</apll> — | || <apll>⎕FEATURE[L]←R</apll> || sets the value(s) of the Feature Control vector indexed by <apll>L</apll> to <apll>R</apll> — a <apll>1</apll> in <apll>R</apll> enables the feature, <apll>0</apll> disables it. | ||
|- | |- | ||
|} | |} | ||
Line 42: | Line 42: | ||
</pre></apll> | </pre></apll> | ||
When enabled, the first feature affects all contexts sensitive to the Index Origin.<br /><br /></li> | When enabled, the first feature affects all contexts sensitive to the Index Origin, such as the <apll>L</apll> in <apll>R[L]</apll>, <apll>R[L]←A</apll>, <apll>R[L]f←A</apll>, <apll>L⌷R</apll>, <apll>L⍉R</apll>, and <apll>L⊃R</apll>.<br /><br /></li> | ||
<li>With the second feature disabled and then enabled: | <li>With the second feature disabled and then enabled: | ||
Line 57: | Line 57: | ||
÷÷∞ ¯∞ | ÷÷∞ ¯∞ | ||
∞ ¯∞ | ∞ ¯∞ | ||
</pre></apll><br /></li> | </pre></apll> | ||
Because <apll>¯0</apll> can not stored as a 64-bit Integer, this feature has a drawback of occasionally forcing a type promotion from Integer to Floating Point. For example, if <apll>R</apll> is an Integer array with <apll>0∊R</apll>, then an expression such as <apll>-R</apll> can no longer be stored as an Integer array, and must be promoted to Floating Point. | |||
<br /></li> | |||
<li>With the third feature disabled and then enabled: | <li>With the third feature disabled and then enabled: | ||
Line 69: | Line 72: | ||
</pre></apll> | </pre></apll> | ||
The industry standard definition of the Floor function on Complex numbers is McDonnell's. However, McDonnell's Floor function isn't defined on Quaternions, but Hurwitz's is: | |||
<apll><pre> | <apll><pre> | ||
a←< | a←<1 3 5 7÷2 | ||
⎕FEATURE[3]←0 ⋄ ⌊a | ⎕FEATURE[3]←0 ⋄ ⌊a | ||
DOMAIN ERROR | DOMAIN ERROR | ||
Line 78: | Line 81: | ||
∧ | ∧ | ||
⎕FEATURE[3]←1 ⋄ ⌊a | ⎕FEATURE[3]←1 ⋄ ⌊a | ||
0<hc>i</hc>1<hc>j</hc>2<hc>k</hc>3</pre></apll> | |||
The two Floor functions return the same result for all Real numbers; they differ only on certain Complex numbers. | |||
The setting of this feature affects not only the result of the Floor function but also all other primitive functions directly or | The setting of this feature affects not only the result of the Floor function but also all other primitive functions directly or | ||
indirectly sensitive to the Floor function including Ceiling, Residue, Greatest Common Divisor, and Least Common Multiple. | indirectly sensitive to the Floor function including Ceiling (<apll>⌈R</apll>), Residue (<apll>L|R</apll>), Greatest Common Divisor (<apll>L∨R</apll>), and Least Common Multiple (<apll>L∧R</apll>). | ||
For more details on this topic, see [http://www.sudleyplace.com/APL/Hypercomplex%20GCD%20in%20APL.pdf Hypercomplex GCD in APL].<br /><br /></li> | For more details on this topic, see [http://www.sudleyplace.com/APL/Hypercomplex%20GCD%20in%20APL.pdf Hypercomplex GCD in APL].<br /><br /></li> |
Revision as of 10:08, 17 April 2018
⎕FEATURE - Feature Control
|
||||
Z is an integer vector whose elements each control a separate experimental Feature of the system. |
⎕FEATURE←R | sets all of the values of the Feature Control Vector to R. |
⎕FEAURE←⍬ | sets all of the values of the Feature Control vector to their system default state. |
⎕FEATURE[L]←R | sets the value(s) of the Feature Control vector indexed by L to R — a 1 in R enables the feature, 0 disables it. |
This system variable allows the user to enable or disable certain experimental features — the initial setting is for all such features to be disabled. The features controlled are as follows:
[1] | Allow negative indices |
[2] | Allow ¯0 |
[3] | User Hurwitz's Floor function instead of McDonnell's |
[4] | Allow NaNs (NaN = Not-a-Number) |
For example,
- With the first feature enabled, in origin-1, the index 1 refers to the first element in a vector and 0 refers to the last element:
⎕FEATURE[1]←1 a←'abcdef' a[0 1 2] fab a[¯2 ¯1 0 1 2] defab ⍳¯3 ¯2 ¯1 0
When enabled, the first feature affects all contexts sensitive to the Index Origin, such as the L in R[L], R[L]←A, R[L]f←A, L⌷R, L⍉R, and L⊃R. - With the second feature disabled and then enabled:
⎕FEATURE[2]←0 ÷∞ ¯∞ 0 0 ÷÷∞ ¯∞ ∞ ∞ ⎕FEATURE[2]←1 ÷∞ ¯∞ 0 ¯0 ÷÷∞ ¯∞ ∞ ¯∞
Because ¯0 can not stored as a 64-bit Integer, this feature has a drawback of occasionally forcing a type promotion from Integer to Floating Point. For example, if R is an Integer array with 0∊R, then an expression such as -R can no longer be stored as an Integer array, and must be promoted to Floating Point.
- With the third feature disabled and then enabled:
a←0.5J¯0.5 ⎕FEATURE[3]←0 ⋄ ⌊a 1J¯1 ⎕FEATURE[3]←1 ⋄ ⌊a 0J0
The industry standard definition of the Floor function on Complex numbers is McDonnell's. However, McDonnell's Floor function isn't defined on Quaternions, but Hurwitz's is:
a←<1 3 5 7÷2 ⎕FEATURE[3]←0 ⋄ ⌊a DOMAIN ERROR ⎕FEATURE[3]←0 ⋄ ⌊a ∧ ⎕FEATURE[3]←1 ⋄ ⌊a 0i1j2k3
The two Floor functions return the same result for all Real numbers; they differ only on certain Complex numbers.
The setting of this feature affects not only the result of the Floor function but also all other primitive functions directly or indirectly sensitive to the Floor function including Ceiling (⌈R), Residue (L|R), Greatest Common Divisor (L∨R), and Least Common Multiple (L∧R).
For more details on this topic, see Hypercomplex GCD in APL. - With the fourth feature disabled and then enabled:
⎕FEATURE[4]←0 0*0J1 DOMAIN ERROR 0*0J1 ∧ ⎕FEATURE[4]←1 0*0J1 ∅J∅
A NaN is a special value supported by Fixed- and Multiple-precision arithmetic "representing an undefined or unrepresentable value, especially in floating-point calculations. Systematic use of NaNs was introduced by the IEEE 754 floating-point standard in 1985, along with the representation of other non-finite quantities like infinities"1.
References
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}}}]]
- This NARS2000 article is a stub and needs further work.