Conjugate a Latin verb: Difference between revisions

Content added Content deleted
m (Thundergnat moved page Conjugate a Latin Verb to Conjugate a Latin verb: Capitalization policy)
(Replaced Wren translation by Go translation.)
Line 322: Line 322:


=={{header|Nim}}==
=={{header|Nim}}==
{{trans|Wren}}
{{trans|Go}}
{{Works with|Nim|1.6.0}}
<lang Nim>import strutils
<lang Nim>import std/[strformat, unicode]


const
proc conjugate(infinitive: string) =
Endings = [["o", "as", "at", "amus", "atis", "ant"],
if not infinitive.endsWith("are"):
["eo", "es", "et", "emus", "etis", "ent"],
raise newException(ValueError, "not a first conjugation verb.")
["o", "is", "it", "imus", "itis", "unt"],
let stem = infinitive[0..^4]
["io", "is", "it", "imus", "itis", "iunt"]]
if stem.len == 0:
InfinEndings = ["are", "ēre", "ere", "ire"]
raise newException(ValueError, "stem cannot be empty.")
Pronouns = ["I", "you (singular)", "he, she or it", "we", "you (plural)", "they"]
echo "Present indicative tense of '$#':" % infinitive
for ending in ["o", "as", "at", "amus", "atis", "ant"]:
EnglishEndings = ["", "", "s", "", "", ""]

echo " ", stem, ending

proc conjugate(infinitive, english: string) =
let letters = infinitive.toRunes()
if letters.len < 4:
raise newException(ValueError, "infinitive is too short for a regular verb.")
let infinEnding = $letters[^3..^1]
let conj = InfinEndings.find(infinEnding)
if conj == -1:
raise newException(ValueError, &"infinitive ending -{infinEnding} not recognized.")
let stem = $letters[0..^4]
echo &"Present indicative tense, active voice, of '{infinitive}' to '{english}':"
for i, ending in Endings[conj]:
echo &" {stem}{ending:4} {Pronouns[i]} {english}{EnglishEndings[i]}"
echo()
echo()



for infinitive in ["amare", "dare"]:
for (infinitive, english) in {"amare": "love", "vidēre": "see", "ducere": "lead", "audire": "hear"}:
conjugate(infinitive)</lang>
conjugate(infinitive, english)</lang>


{{out}}
{{out}}
<pre>Present indicative tense of 'amare':
<pre>Present indicative tense, active voice, of 'amare' to 'love':
amo
amo I love
amas you (singular) love
amas
amat he, she or it loves
amat
amamus
amamus we love
amatis
amatis you (plural) love
amant
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 of 'dare':
Present indicative tense, active voice, of 'audire' to 'hear':
audio I hear
do
audis you (singular) hear
das
audit he, she or it hears
dat
audimus we hear
damus
auditis you (plural) hear
datis
dant</pre>
audiunt they hear</pre>


=={{header|Perl}}==
=={{header|Perl}}==