Conjugate a Latin verb: Difference between revisions

no edit summary
No edit summary
Line 830:
datis
dant
</pre>
 
=={{header|Vlang}}==
{{trans|Go}}
The 'extended' version.
<syntaxhighlight lang="vlang">
import log
 
const
(
endings = [
["o", "as", "at", "amus", "atis", "ant"],
["eo", "es", "et", "emus", "etis", "ent"],
["o", "is", "it", "imus", "itis", "unt"],
["io", "is", "it", "imus", "itis", "iunt"]
]
infin_endings = ["are", "ēre", "ere", "ire"]
pronouns = ["I", "you (singular)", "he, she or it", "we", "you (plural)", "they"]
english_endings = ["", "", "s", "", "", ""]
)
 
fn main() {
pairs := [["amare", "love"], ["vidēre", "see"], ["ducere", "lead"], ["audire", "hear"]] // add to check errors
for _, pair in pairs {
conjugate(pair[0], pair[1])
}
}
 
fn conjugate(infinitive string, english string) {
letters := infinitive.runes()
le := letters.len
mut lg := log.Log{}
mut infin_ending, mut stem := '', ''
mut conj := 0
lg.set_level(.error)
lg.set_full_logpath('./info.log')
if le < 4 {
lg.error("Infinitive (${letters.string()}) is too short for a regular verb.")
exit(1)
}
infin_ending = letters[le - 3..].string()
conj = -1
for i, s in infin_endings {
if s == infin_ending {
conj = i
break
}
}
if conj == -1 {
lg.error("Infinitive ending -${infin_ending} not recognized.")
exit(1)
}
stem = letters[..le - 3].string()
print("Present indicative tense, active voice, of ${infinitive} to '${english}':\n")
for i, ending in endings[conj] {
print(" ${stem}${ending} ${pronouns[i]} ${english}${english_endings[i]}\n")
}
println('')
}
</syntaxhighlight>
 
{{out}}
<pre>
Present indicative tense, active voice, of amare to 'love':
amo I love
amas you (singular) love
amat he, she or it loves
amamus we love
amatis you (plural) love
amant they love
 
Present indicative tense, active voice, of vidēre to 'see':
video I see
vides you (singular) see
videt he, she or it sees
videmus we see
videtis you (plural) see
vident they see
 
Present indicative tense, active voice, of ducere to 'lead':
duco I lead
ducis you (singular) lead
ducit he, she or it leads
ducimus we lead
ducitis you (plural) lead
ducunt they lead
 
Present indicative tense, active voice, of audire to 'hear':
audio I hear
audis you (singular) hear
audit he, she or it hears
audimus we hear
auditis you (plural) hear
audiunt they hear
</pre>
 
291

edits