Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
59
Task/Morse-code/Langur/morse-code.langur
Normal file
59
Task/Morse-code/Langur/morse-code.langur
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
val morse_code = {
|
||||
"A": ".-",
|
||||
"B": "-...",
|
||||
"C": "-.-.",
|
||||
"D": "-..",
|
||||
"E": ".",
|
||||
"F": "..-.",
|
||||
"G": "--.",
|
||||
"H": "....",
|
||||
"I": "..",
|
||||
"J": ".---",
|
||||
"K": "-.-",
|
||||
"L": ".-..",
|
||||
"M": "--",
|
||||
"N": "-.",
|
||||
"O": "---",
|
||||
"P": ".--.",
|
||||
"Q": "--.-",
|
||||
"R": ".-.",
|
||||
"S": "...",
|
||||
"T": "-",
|
||||
"U": "..-",
|
||||
"V": "...-",
|
||||
"W": ".--",
|
||||
"X": "-..-",
|
||||
"Y": "-.--",
|
||||
"Z": "--..",
|
||||
|
||||
"0": "-----",
|
||||
"1": ".----",
|
||||
"2": "..---",
|
||||
"3": "...--",
|
||||
"4": "....-",
|
||||
"5": ".....",
|
||||
"6": "-....",
|
||||
"7": "--...",
|
||||
"8": "---..",
|
||||
"9": "----.",
|
||||
|
||||
".": ".-.-.-",
|
||||
" ": " ",
|
||||
}
|
||||
|
||||
val conv = fn(s string) {
|
||||
for[=""] i of s {
|
||||
_for ~= morse_code[cp2s(ucase(s[i])); "........"]
|
||||
if i < len(s): _for ~= " "
|
||||
}
|
||||
}
|
||||
|
||||
val test = fn*(s string) {
|
||||
# with 2 different methods of transliteration
|
||||
writeln "orig. string: ", s
|
||||
writeln "morse code1 : ", conv(s)
|
||||
writeln "morse code2 : ", tran(ucase(s), with=morse_code, delim=" ")
|
||||
writeln()
|
||||
}
|
||||
|
||||
test("This is a test.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue