Download or view collatorTest.frink in plain text format
/** This file demonstrates sorting strings lexicographically according to the
rules defined by different natural languages.
*/
/* Spanish. Huh. I was wondering why none of this was sorting according
to the rules I learned in school and after much beating my head on it, I
learned:
"Spanish treated (until 1994) "CH" and "LL" as single letters,
giving an ordering of cinco, credo, chispa and lomo, luz, llama. This is
not true anymore since in 1994 the RAE adopted the more conventional usage,
and now LL is collated between LK and LM, and CH between CG and CI. The six
characters with diacritics Á, É, Í, Ó, Ú, Ü are treated as the original
letters A, E, I, O, U, for example: radio, ráfaga, rana, rápido, rastrillo.
The only Spanish-specific collating question is Ñ (eñe) as a different
letter collated after N."
https://en.wikipedia.org/wiki/Alphabetical_order
*/
//a = ["jueves", "verde", "amarillo", "blanco", "lima", "llave", "llover", "loma", "cinco", "domingo", "rojo", "crudo", "chile", "casa", "chalina", "curioso", "llama", "luz", "alos", "alla", "ala", "eñe", "ene", "enne"]
a = ["ökonomisch", "offenbar", "olfaktorisch", "Arg", "Ärgerlich", "Arm", "Assistent", "Aßlar", "Assoziation", "eñe", "ene", "enne"]
println["Dumb sort: " + sort[a]]
println["Default: " + lexicalSort[a]]
println["English: " + lexicalSort[a, "en"]]
println["Spanish: " + lexicalSort[a, "es"]] // As of 1994, only new rule is ñ sorted after n
println["German: " + lexicalSort[a, "de"]] // "offenbar", "ökonomisch", "olfaktorisch"
println["Turkish: " + lexicalSort[a, "tr"]] // ö is sorted after o
Download or view collatorTest.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen was born 20143 days, 10 hours, 38 minutes ago.