Conjugate a Latin verb: Difference between revisions

Replaced Wren translation by Go translation.
m (Thundergnat moved page Conjugate a Latin Verb to Conjugate a Latin verb: Capitalization policy)
(Replaced Wren translation by Go translation.)
Line 322:
 
=={{header|Nim}}==
{{trans|WrenGo}}
{{Works with|Nim|1.6.0}}
<lang Nim>import strutilsstd/[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
forEnglishEndings ending in= ["o", "as", "ats", "amus", "atis", "ant"]:
 
echo " ", stem, ending
 
proc conjugate(infinitive, english: string) =
let letters = infinitive.toRunes()
if stemletters.len ==< 04:
raise newException(ValueError, "notinfinitive ais firsttoo short for a conjugationregular verb.")
let infinEnding = $letters[^3..^1]
let conj = InfinEndings.find(infinEnding)
if conj == -1:
raise newException(ValueError, &"steminfinitive cannotending be-{infinEnding} emptynot recognized.")
let stem = infinitive$letters[0..^4]
echo &"Present indicative tense, active voice, of '$#{infinitive}':" %to infinitive'{english}':"
for i, ending in Endings[conj]:
echo &" {stem}{ending:4} {Pronouns[i]} {english}{EnglishEndings[i]}"
echo()
 
 
for infinitive in ["amare", "dare"]:
for (infinitive, english) in {"amare": "love", "vidēre": "see", "ducere": "lead", "audire": "hear"}:
conjugate(infinitive, english)</lang>
 
{{out}}
<pre>Present indicative tense, active voice, of 'amare' to 'love':
amo I love
amas you (singular) love
amas
amat he, she or it loves
amat
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 'dareaudire' 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 audiunt they hear</pre>
 
=={{header|Perl}}==
Anonymous user