System Variable FEATURE: Difference between revisions
No edit summary |
mNo edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
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 23: | Line 23: | ||
||<apll>[3]</apll> || User Hurwitz's Floor function instead of McDonnell's | ||<apll>[3]</apll> || User Hurwitz's Floor function instead of McDonnell's | ||
|- | |- | ||
||<apll>[4]</apll> || | ||<apll>[4]</apll> || '''Withdrawn''' (formerly used to allow NaNs) | ||
|- | |- | ||
||<apll>[5]</apll> || Use APL2's definition of Inner Product | |||
|} | |} | ||
Line 42: | Line 43: | ||
</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 58: | ||
÷÷∞ ¯∞ | ÷÷∞ ¯∞ | ||
∞ ¯∞ | ∞ ¯∞ | ||
</pre></apll><br /></li> | </pre></apll> | ||
Because <apll>¯0</apll> can not be stored as a 64-bit Integer, enabling 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 the entire array must be promoted to Floating Point, possibly losing precision because 64-bit Integers have <apll>63</apll> bits of precision and 64-bit Floating Point numbers have only <apll>53</apll>.<br /> | |||
For example,<apll><pre> | |||
⎕FEATURE[2]←0 | |||
0 ⎕DR ⎕←-¯1 0 1,⌊2*62 | |||
1 0 ¯1 ¯4611686018427387904 | |||
Integer (6412): 64 bits per element | |||
⎕FEATURE[2]←1 | |||
0 ⎕DR ⎕←-¯1 0 1,⌊2*62 | |||
1 ¯0 ¯1 ¯4.611686018427388E18 | |||
Floating Point (6413): 64 bits per element</pre></apll> | |||
</li> | |||
<li>With the third feature disabled and then enabled: | <li>With the third feature disabled and then enabled: | ||
Line 69: | Line 83: | ||
</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 92: | ||
∧ | ∧ | ||
⎕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> | ||
<li>With the | <li>The fourth feature has been withdrawn.</li> | ||
<li>With the fifth feature disabled and then enabled: | |||
<apll><pre> | <apll><pre> | ||
⎕FEATURE[ | a←3 6⍴'Queue EschewAchoo ' | ||
a | |||
Queue | |||
Eschew | |||
Achoo | |||
⎕FEATURE[ | ⎕FEATURE[5]←0 | ||
a+.∊'aeiou' | |||
LENGTH ERROR | |||
a+.∊'aeiou' | |||
∧ | |||
⎕FEATURE[5]←1 | |||
a+.∊'aeiou' | |||
4 1 2 | |||
</pre></apll> | |||
<br /></li> | <br /></li> | ||
</ul> | </ul> | ||
{{System Variables}} | {{System Variables}} | ||
{{Article footer}} | {{Article footer}} | ||
{{stub}} | {{stub}} |
Latest revision as of 15:40, 12 January 2023
⎕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] | Withdrawn (formerly used to allow NaNs) |
[5] | Use APL2's definition of Inner Product |
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 be stored as a 64-bit Integer, enabling 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 the entire array must be promoted to Floating Point, possibly losing precision because 64-bit Integers have 63 bits of precision and 64-bit Floating Point numbers have only 53.
For example,
⎕FEATURE[2]←0 0 ⎕DR ⎕←-¯1 0 1,⌊2*62 1 0 ¯1 ¯4611686018427387904 Integer (6412): 64 bits per element ⎕FEATURE[2]←1 0 ⎕DR ⎕←-¯1 0 1,⌊2*62 1 ¯0 ¯1 ¯4.611686018427388E18 Floating Point (6413): 64 bits per element
- 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. - The fourth feature has been withdrawn.
- With the fifth feature disabled and then enabled:
a←3 6⍴'Queue EschewAchoo ' a Queue Eschew Achoo ⎕FEATURE[5]←0 a+.∊'aeiou' LENGTH ERROR a+.∊'aeiou' ∧ ⎕FEATURE[5]←1 a+.∊'aeiou' 4 1 2
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.