Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
89 lines (69 sloc) 2.7 KB
:Namespace Sort
⎕ML1
Classic{
⎕AV ⍺⍺ Sort Mix
}
Natural{
ABCabc
Digits⎕D
CutOffs1,2/Digits
PartsCutOffs
ExecNums{
⊃⊃⎕VFI :
}
NORMNormExecNums¨Parts¨
abc ⍺⍺ Sort Norm
}
Danish{ http://sproget.dk/raad-og-regler/Retskrivningsregler/retskrivningsregler/a7-1-6/a7-4-alfabetisk-rekkefolge
ABCabc'ÁÀ' 'Ç' 'Ð' 'ÉÈË' 'Þ' 'ÍÌÏ' 'ÓÒ' 'Ú' 'ÝÜ' 'ÄǼ' 'ÖǾ' ''VariantsOf'ACDEHIOUYÆØÅ'' ',⎕A,'ÆØÅ'
NORMNorm'aa' 'Aa' 'AA' 'þ' 'Þ'⎕R'ӑ' 'Ӑ' 'Ӑ' '' '' n.b. not ligatures
abc ⍺⍺ Sort Norm
}
Finnish{ https://en.wikipedia.org/wiki/Finnish_orthography#Collation_order
ABCabc'DĐÐ' 'EÉÆŒ' '' '' '' 'VW' 'SŠẞ' 'YÜŰ' '' 'ÖØÕŐ'VariantsOf'DELNOVSYZÖ'' ',⎕A,'ÅÄÖ'~'W'
NORMNorm'AOS'ExpLigs'ÆŒẞ'
abc ⍺⍺ Sort Norm
}
German{ https://en.wikipedia.org/wiki/German_orthography#Sorting
ABCabc'aAäÄ' 'oOöÖ' 'ßẞsS' 'uUüÜ'VariantsOf'AOSU'' ',⎕A
NORMNorm'sS'ExpLigs'ßẞ'
abc ⍺⍺ Sort Norm
}
:Section Utils
Under{ a.k.a. Dual
11::A(A) ⍺⍺A if function cannot be inverted, try acting on shape rather than data
2=⎕NC'':⍵⍵¯1(⍵⍵ )⍺⍺(⍵⍵ )
⍵⍵¯1 ⍺⍺ ⍵⍵
}
AtUE{ @ Under ∊
⍺⍺@⍵⍵ Under
}
ExpLigs{ Expand Ligatures
from,LoUp ⍵⍵
to,LoUp ⍺⍺,¨⍵⍵
from ⎕R to
}
VariantsOf{
base' ',⍵⍵
addspaces,⍺⍺
from,¨base,'.'
to'&',base,¨add
Full from ⎕S to' ',
}
Sort{
⍺⍺ Mix ⍵⍵
}
Mix{ ↑⍣≡ padding with ⎕UCS 0
' 'AtUE(=last)zero AtUE IsSplast AtUE IsSp
}
(zero last)⎕UCS 0 1114111 first and last Uniocde code points
spaces'.''-/'
IsSp' '=
LoUp0 1.(,819) Fold to lower and upper
Full1 3 2LoUp Convert nested uppercase to full ⍋-style alphabet
:EndSection
:EndNamespace
You can’t perform that action at this time.