System Function CS: Difference between revisions

From NARS2000
Jump to navigationJump to search
mNo edit summary
No edit summary
 
Line 4: Line 4:
|<apll>Z←⎕CS</apll>
|<apll>Z←⎕CS</apll>
|returns a well-known Collating Sequence for grading character arrays, extended to account for accented Latin alphabets.}}
|returns a well-known Collating Sequence for grading character arrays, extended to account for accented Latin alphabets.}}
{{BoxEnd|<apll>Z</apll> is a four-dimensional character array of shape <apll>10 6 2 28 </apll> with <apll>3360 ≡ ×/10 6 2 28</apll> characters.}}
{{BoxEnd|<apll>Z</apll> is a four-dimensional character array of shape <apll>10 6 2 27 </apll> with <apll>3240 ≡ ×/10 6 2 27</apll> characters.}}


The values as arranged as follows:
The values as arranged as follows:
* The length <apll>28</apll> coordinate contains one space followed by a 26-letter Latin alphabet and another space.
* The length <apll>27</apll> coordinate contains one space followed by a 26-letter Latin alphabet.
* The length <apll>2</apll> coordinate distinguishes between the lowercase from the uppercase of the Latin alphabet.
* The length <apll>2</apll> coordinate distinguishes between the lowercase from the uppercase of the Latin alphabet.
* The length <apll>6</apll> coordinate distinguishes between the [[System_Function_A|one unaccented and five accented Latin alphabets]].
* The length <apll>6</apll> coordinate distinguishes between the [[System_Function_A|one unaccented and five accented Latin alphabets]].
Line 13: Line 13:
* All other values not specified above are blank.
* All other values not specified above are blank.


While this collating sequence is very useful, it is not the end of the question. It needs to be modified for special circumstances, for example if you are grading numbers with a decimal point.  Think of it as a starting point for more special purpose needs.
While this collating sequence is very useful, it is not the end of the question. It needs to be modified for special circumstances, for example, if you are grading numbers with a decimal point.  Think of it as a starting point for more special purpose needs.


To give you a flavor of this sequence, here's the first hyperplane of <apll>⎕CS</apll>, where a Blank Symbol (<apll>␢</apll>) is used in place of a space to serve as a visible reminder of its presence:
To give you a flavor of this sequence, here's the first hyperplane of <apll>⎕CS</apll>, where a Blank Symbol (<apll>␢</apll>) is used in place of a space to serve as a visible reminder of its presence:


<apll>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕CS[1;;;]<br/>
<apll>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕CS[1;;;]<br/>
␢abcdefghijklmnopqrstuvwxyz0<br/>
␢abcdefghijklmnopqrstuvwxyz<br/>
␢ABCDEFGHIJKLMNOPQRSTUVWXYZ␢<br/>
0ABCDEFGHIJKLMNOPQRSTUVWXYZ<br/>
<br/>
<br/>
␢ábćdéfǵhíjḱĺḿńóṕqŕśtúvẃxýź␢<br/>
␢ábćdéfǵhíjḱĺḿńóṕqŕśtúvẃxýź<br/>
␢ÁBĆDÉFǴHÍJḰĹḾŃÓṔQŔŚTÚVẂXÝŹ␢<br/>
␢ÁBĆDÉFǴHÍJḰĹḾŃÓṔQŔŚTÚVẂXÝŹ<br/>
<br/>
<br/>
␢àbcdèfghìjklmǹòpqrstùvẁxỳz␢<br/>
␢àbcdèfghìjklmǹòpqrstùvẁxỳz<br/>
␢ÀBCDÈFGHÌJKLMǸÒPQRSTÙVẀXỲZ␢<br/>
␢ÀBCDÈFGHÌJKLMǸÒPQRSTÙVẀXỲZ<br/>
<br/>
<br/>
␢âbĉdêfĝĥîĵklmnôpqrstuvwxyz␢<br/>
␢âbĉdêfĝĥîĵklmnôpqrstuvwxyz<br/>
␢ÂBĈDÊFĜĤÎĴKLMNÔPQRŜTÛVŴXŶẐ␢<br/>
␢ÂBĈDÊFĜĤÎĴKLMNÔPQRŜTÛVŴXŶẐ<br/>
<br/>
<br/>
␢äbcdëfgḧïjklmnöpqrsẗüvẅẍÿz␢<br/>
␢äbcdëfgḧïjklmnöpqrsẗüvẅẍÿz<br/>
␢ÄBCDËFGḦÏJKLMNÖPQRSTÜVẄẌŸZ␢<br/>
␢ÄBCDËFGḦÏJKLMNÖPQRSTÜVẄẌŸZ<br/>
<br/>
<br/>
␢ãbcdẽfghĩjklmñõpqrstũṽwxỹz␢<br/>
␢ãbcdẽfghĩjklmñõpqrstũṽwxỹz<br/>
␢ÃBCDẼFGHĨJKLMÑÕPQRSTŨṼWXỸZ␢<br/>
␢ÃBCDẼFGHĨJKLMÑÕPQRSTŨṼWXỸZ<br/>
</apll>
</apll>


Line 41: Line 41:
<apll>&nbsp;&nbsp;&nbsp;&nbsp;∇ Z←⎕CS;⎕IO<br/>
<apll>&nbsp;&nbsp;&nbsp;&nbsp;∇ Z←⎕CS;⎕IO<br/>
[1] &nbsp; ⎕IO←1<br/>
[1] &nbsp; ⎕IO←1<br/>
[2] &nbsp; Z←10 6 2 28⍴' '<br/>
[2] &nbsp; Z←10 6 2 27⍴' '<br/>
[3] &nbsp; Z[1;1;;1+⍳26]←⎕a,[0.5] ⎕A<br/>
[3] &nbsp; Z[1;1;;1+⍳26]←⎕a,[0.5] ⎕A<br/>
[4] &nbsp; Z[1;2;;1+⍳26]←⎕á,[0.5] ⎕Á<br/>
[4] &nbsp; Z[1;2;;1+⍳26]←⎕á,[0.5] ⎕Á<br/>
Line 48: Line 48:
[7] &nbsp; Z[1;5;;1+⍳26]←⎕ä,[0.5] ⎕Ä<br/>
[7] &nbsp; Z[1;5;;1+⍳26]←⎕ä,[0.5] ⎕Ä<br/>
[8] &nbsp; Z[1;6;;1+⍳26]←⎕ã,[0.5] ⎕Ã<br/>
[8] &nbsp; Z[1;6;;1+⍳26]←⎕ã,[0.5] ⎕Ã<br/>
[9] &nbsp; Z[;1;1;28]←⎕D<br/>
[9] &nbsp; Z[;1;2;1]←⎕D<br/>
&nbsp;&nbsp;&nbsp;&nbsp;∇</apll>
&nbsp;&nbsp;&nbsp;&nbsp;∇</apll>



Latest revision as of 17:58, 12 December 2017

⎕CS - Collating Sequence

⎕CS is niladic system function which returns a well-known collating sequence appropriate to grading character arrays via the Dyadic Grade function.

Z←⎕CS returns a well-known Collating Sequence for grading character arrays, extended to account for accented Latin alphabets.
Z is a four-dimensional character array of shape 10 6 2 27 with 3240 ≡ ×/10 6 2 27 characters.

The values as arranged as follows:

  • The length 27 coordinate contains one space followed by a 26-letter Latin alphabet.
  • The length 2 coordinate distinguishes between the lowercase from the uppercase of the Latin alphabet.
  • The length 6 coordinate distinguishes between the one unaccented and five accented Latin alphabets.
  • The length 10 coordinate distinguishes between the ten digits.
  • All other values not specified above are blank.

While this collating sequence is very useful, it is not the end of the question. It needs to be modified for special circumstances, for example, if you are grading numbers with a decimal point. Think of it as a starting point for more special purpose needs.

To give you a flavor of this sequence, here's the first hyperplane of ⎕CS, where a Blank Symbol () is used in place of a space to serve as a visible reminder of its presence:

      ⎕CS[1;;;]
␢abcdefghijklmnopqrstuvwxyz
0ABCDEFGHIJKLMNOPQRSTUVWXYZ

␢ábćdéfǵhíjḱĺḿńóṕqŕśtúvẃxýź
␢ÁBĆDÉFǴHÍJḰĹḾŃÓṔQŔŚTÚVẂXÝŹ

␢àbcdèfghìjklmǹòpqrstùvẁxỳz
␢ÀBCDÈFGHÌJKLMǸÒPQRSTÙVẀXỲZ

␢âbĉdêfĝĥîĵklmnôpqrstuvwxyz
␢ÂBĈDÊFĜĤÎĴKLMNÔPQRŜTÛVŴXŶẐ

␢äbcdëfgḧïjklmnöpqrsẗüvẅẍÿz
␢ÄBCDËFGḦÏJKLMNÖPQRSTÜVẄẌŸZ

␢ãbcdẽfghĩjklmñõpqrstũṽwxỹz
␢ÃBCDẼFGHĨJKLMÑÕPQRSTŨṼWXỸZ

The following APL pseudo-function describes how ⎕CS could be created:

    ∇ Z←⎕CS;⎕IO
[1]   ⎕IO←1
[2]   Z←10 6 2 27⍴' '
[3]   Z[1;1;;1+⍳26]←⎕a,[0.5] ⎕A
[4]   Z[1;2;;1+⍳26]←⎕á,[0.5] ⎕Á
[5]   Z[1;3;;1+⍳26]←⎕à,[0.5] ⎕À
[6]   Z[1;4;;1+⍳26]←⎕â,[0.5] ⎕Â
[7]   Z[1;5;;1+⍳26]←⎕ä,[0.5] ⎕Ä
[8]   Z[1;6;;1+⍳26]←⎕ã,[0.5] ⎕Ã
[9]   Z[;1;2;1]←⎕D
    ∇

See also: Unicode page and ⎕A and friends.


Note: CS is a niladic 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
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