Abbreviations, automatic: Difference between revisions

Content deleted Content added
added a draft task, also added the REXX language (as an example).
 
Thundergnat (talk | contribs)
→‎{{header|Perl 6}}: Add a Perl 6 example
Line 141:
 
 
 
=={{header|Perl 6}}==
{{works with|Rakudo|2017.08}}
Saving the "Days of Week, Also Known As" table to a local file DoWAKA.txt. Note: lines that have duplicate day names will get ∞ as the minimum number of characters, as there in no amount of characters that can be entered to distinguish the days uniquely.
 
<lang perl6> for './DoWAKA.txt'.IO.lines {
my @days = .words;
my $max = @days».chars.max;
for 0 .. $max {
say "$_: {@days}" and last if +@days».substr(0, $_).Set == 7;
say "∞: {@days}" and last if $_ == $max;
}
}</lang>
{{out|Sample abbreviated (heh) output}}
<pre>2: Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2: Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4: E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2: Ehud Segno Maksegno Erob Hamus Arbe Kedame
5: Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4: Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2: domingu llunes martes miércoles xueves vienres sábadu
2: Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6: Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4: Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2: Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5: Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2: nedelia ponedelnik vtornik sriada chetvartak petak sabota
∞: sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk sing_kei_yat
4: Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16: Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahze
...
4: djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2: Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau
</pre>
 
=={{header|REXX}}==