>>
<<
Ndx
Usr
Pri
Phr
Dic
Rel
Voc
!:
wd
Help
Dictionary
12. Sorting
The sort x /: y re-orders x according to the
grade of y , that is, /:y :
x=: 2 7 1 8 [ y=: 1 7 3 2
(/:y);((/:y){x);(x/:y);(x/:x)
+-------+-------+-------+-------+
|0 3 2 1|2 8 1 7|2 8 1 7|1 2 7 8|
+-------+-------+-------+-------+
The grade and sort of literal characters is based upon the
ordering of the underlying alphabet a. .
For example, if the name "text" is used for the present sentence
(up to and including the colon), then:
tdw=: >dwds=: ~. wds=: ;: text
($tdw),($dwds),($wds),($text)
21 9 21 25 103
]alph=: a. {~ ,(i. 26) +/ (a.i.'aA')
aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
tdw; (tdw /: tdw);(tdw/: alph i. tdw)
+---------+---------+---------+
|For |" |and |
|example |( |colon |
|, |) |example |
|if |, |for |
|the |For |For |
|name |and |if |
|" |colon |including|
|text |example |is |
|is |for |name |
|used |if |present |
|for |including|sentence |
|present |is |text |
|sentence |name |then: |
|( |present |the |
|up |sentence |to |
|to |text |up |
|and |the |used |
|including|then: |, |
|colon |to |" |
|) |up |( |
|then: |used |) |
+---------+---------+---------+
The middle column is the alphabetized table of
distinct words, but (because the cases are not interleaved
in the alphabet a.), the words "for" and "For"
are widely separated; they are brought together in the last
column by indexing the table by a suitable alphabet.
>>
<<
Ndx
Usr
Pri
Phr
Dic
Rel
Voc
!:
wd
Help
Dictionary