Conjugate a Latin verb: Difference between revisions

Content added Content deleted
(→‎{{header|ALGOL 68}}: Changed to revised task reuirements)
(→‎{{header|Wren}}: Added English meanings to extended version.)
Line 479: Line 479:
</pre>
</pre>
<br>
<br>
{{libheader|Wren-fmt}}
The following extended version can deal with regular verbs of all four conjugations. To distinguish 2nd and 3rd conjugations, an over-bar is placed above the penultimate 'e' in a second conjugation infinitive but accents are otherwise ignored.
The following extended version can deal with regular verbs of all four conjugations. To distinguish 2nd and 3rd conjugations, a bar is placed above the penultimate 'e' in a second conjugation infinitive but accents are otherwise ignored. English meanings have also been added.
<lang ecmascript>var endings = [
<lang ecmascript>import "/fmt" for Fmt

var endings = [
[ "o", "as", "at", "amus", "atis", "ant"],
[ "o", "as", "at", "amus", "atis", "ant"],
["eo", "es", "et", "emus", "etis", "ent"],
["eo", "es", "et", "emus", "etis", "ent"],
Line 489: Line 492:
var infinEndings = ["are", "ēre", "ere", "ire"]
var infinEndings = ["are", "ēre", "ere", "ire"]


var pronouns = ["I", "you (singular)", "he, she or it", "we", "you (plural)", "they"]
var conjugate = Fn.new { |infinitive|

var englishEndings = [ "", "", "s", "", "", "" ]

var conjugate = Fn.new { |infinitive, english|
var letters = infinitive.toList
var letters = infinitive.toList
if (letters.count < 4) Fiber.abort("Infinitive is too short for a regular verb.")
if (letters.count < 4) Fiber.abort("Infinitive is too short for a regular verb.")
Line 496: Line 503:
if (conj == -1) Fiber.abort("Infinitive ending -%(infinEnding) not recognized.")
if (conj == -1) Fiber.abort("Infinitive ending -%(infinEnding) not recognized.")
var stem = letters[0..-4].join()
var stem = letters[0..-4].join()
System.print("Present indicative tense, active voice, of '%(infinitive)':")
System.print("Present indicative tense, active voice, of '%(infinitive)' to '%(english)':")
var i = 0
for (ending in endings[conj]) System.print(" " + stem + ending)
for (ending in endings[conj]) {
Fmt.print(" $s$-4s $s $s$s", stem, ending, pronouns[i], english, englishEndings[i])
i = i + 1
}
System.print()
System.print()
}
}


for (infinitive in ["amare", "vidēre", "ducere", "audire"]) conjugate.call(infinitive)</lang>
var pairs = [["amare", "love"], ["vidēre", "see"], ["ducere", "lead"], ["audire", "hear"]]
for (pair in pairs) conjugate.call(pair[0], pair[1])</lang>


{{out}}
{{out}}
<pre>
<pre>
Present indicative tense, active voice, of 'amare':
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':
Present indicative tense, active voice, of 'vidēre' to 'see':
video
video I see
vides
vides you (singular) see
videt
videt he, she or it sees
videmus
videmus we see
videtis
videtis you (plural) see
vident
vident they see


Present indicative tense, active voice, of 'ducere':
Present indicative tense, active voice, of 'ducere' to 'lead':
duco
duco I lead
ducis
ducis you (singular) lead
ducit
ducit he, she or it leads
ducimus
ducimus we lead
ducitis
ducitis you (plural) lead
ducunt
ducunt they lead


Present indicative tense, active voice, of 'audire':
Present indicative tense, active voice, of 'audire' to 'hear':
audio
audio I hear
audis
audis you (singular) hear
audit
audit he, she or it hears
audimus
audimus we hear
auditis
auditis you (plural) hear
audiunt
audiunt they hear
</pre>
</pre>