Difference between revisions of "System Variable FC"

From NARS2000
Jump to: navigation, search
(new stub)
 
 
Line 1: Line 1:
<h1>{quad}FC - DEFINITION NEEDED</h1>
+
<h1><aplxx>⎕FC</aplxx> - Format Control</h1>
{{BoxStart|⎕FC
+
{{BoxStart|<apll>Z←⎕FC</apll>
| DEFINITION NEEDED}}
+
| returns the current value of the Format Control vector.}}
{{BoxEnd|⎕FC←'<i>VALUE</i>'}}
+
{{BoxEnd|<apll>Z</apll> is a character vector whose elements each control a separate aspect of how numeric output is formatted by the system.}}
 +
<br />
 +
{| border="1" cellpadding="5" cellspacing="0" rules="none" summary=""
 +
|| <apll>⎕FC←R</apll> ||  sets all of the values of the Format Control Vector to <apll>R</apll>.
 +
|-
 +
| valign="top" |<apll>⎕FC←⍬</apll> || sets all of the values of the Format Control vector to their system default state.
 +
|-
 +
|| <apll>⎕FC[L]←R</apll> || sets the value(s) of the Format Control vector indexed by <apll>L</apll> to <apll>R</apll>.
 +
|-
 +
|}
 +
<br />
  
Description here - to do
+
The first seven elements of <apll>⎕FC</apll> control the raw output of numeric display as well as the monadic and dyadic forms of the Format function (<apll>⍕</apll>).
 +
 
 +
{| border="1" cellpadding="5" rules="all" summary=""
 +
||'''Index'''||'''Name'''||'''Default<br />Value'''
 +
|-
 +
|align="center"|[1]||Decimal Point Separator||<apll>'.'</apll>
 +
|-
 +
|align="center"|[2]||Thousands Separator||<apll>','</apll>
 +
|-
 +
|align="center"|[3]||Format-by-example '8' Fill||<apll>'*'</apll>
 +
|-
 +
|align="center"|[4]||Format-by-example Overflow fill||<apll>'0'</apll>
 +
|-
 +
|align="center"|[5]||Blank Fill (not <apll>",.0123456789"</apll>)||<apll>'_'</apll>
 +
|-
 +
|align="center"|[6]||Negative Sign||<apll>'¯'</apll>
 +
|-
 +
|align="center"|[7]||Complex Number Display Separator (only <apll>"iJdhru"</apll>)||<apll>'J'</apll>
 +
|-
 +
|}
 +
 
 +
For example,
 +
 
 +
<apll><pre>
 +
      f←{⎕FC[1⊃⍺]←2⊃⍺ ⋄ ⍕⍵}
 +
      (1 6) ':-' f ¯23.2
 +
-23:2
 +
      (1 6 7) ':-d' f ¯23.2<_i/>0
 +
23:2<_ad/>180:0
 +
      7 'i' f ¯2<_i/>3
 +
¯2<_i/>3
 +
      7 'J' f ¯2<_i/>3
 +
¯2<_J/>3
 +
      7 'd' f ¯2<_i/>3
 +
3.605551275<_ad/>123.7
 +
      7 'h' f ¯2<_i/>3
 +
3.605551275<_ah/>0.3436
 +
      7 'r' f ¯2<_i/>3
 +
3.605551275<_ar/>2.159
 +
      7 'u' f ¯2<_i/>3
 +
3.605551275<_au/>0.3436
 +
</pre></apll>
 +
 
 +
At the moment because Format-By-Example (<apll>L⍕R</apll> for Character Vector <apll>L</apll>) is not implemented in NARS2000, <apll>⎕FC[3]</apll> is not referenced.
 +
 
 +
Because the system function <apll>⎕FMT</apll> has its own Symbol Substitution mechanism, it is not sensitive to the settings in <apll>⎕FC</apll>.
  
 
{{System Variables}}
 
{{System Variables}}
 
{{Article footer}}
 
{{Article footer}}
 
{{stub}}
 
{{stub}}

Latest revision as of 17:44, 13 August 2019

⎕FC - Format Control

Z←⎕FC returns the current value of the Format Control vector.
Z is a character vector whose elements each control a separate aspect of how numeric output is formatted by the system.


⎕FC←R sets all of the values of the Format Control Vector to R.
⎕FC←⍬ sets all of the values of the Format Control vector to their system default state.
⎕FC[L]←R sets the value(s) of the Format Control vector indexed by L to R.


The first seven elements of ⎕FC control the raw output of numeric display as well as the monadic and dyadic forms of the Format function ().

Index Name Default
Value
[1] Decimal Point Separator '.'
[2] Thousands Separator ','
[3] Format-by-example '8' Fill '*'
[4] Format-by-example Overflow fill '0'
[5] Blank Fill (not ",.0123456789") '_'
[6] Negative Sign '¯'
[7] Complex Number Display Separator (only "iJdhru") 'J'

For example,

      f←{⎕FC[1⊃⍺]←2⊃⍺ ⋄ ⍕⍵}
      (1 6) ':-' f ¯23.2
-23:2
      (1 6 7) ':-d' f ¯23.2i0
23:2ad180:0
      7 'i' f ¯2i3
¯2i3
      7 'J' f ¯2i3
¯2J3
      7 'd' f ¯2i3
3.605551275ad123.7
      7 'h' f ¯2i3
3.605551275ah0.3436
      7 'r' f ¯2i3
3.605551275ar2.159
      7 'u' f ¯2i3
3.605551275au0.3436

At the moment because Format-By-Example (L⍕R for Character Vector L) is not implemented in NARS2000, ⎕FC[3] is not referenced.

Because the system function ⎕FMT has its own Symbol Substitution mechanism, it is not sensitive to the settings in ⎕FC.

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
+ - × ÷ * ! ? |
= < >
~ § π .. ,
/ \ ¨ .
_ ¯ b e g p r v x



This NARS2000 article is a stub and needs further work.