Conjugate a Latin verb: Difference between revisions

m
 
(35 intermediate revisions by 22 users not shown)
Line 4:
[[Category:Simple]]
 
;Task: Create a program that can take a Latin verb and conjugate it, displaying in the following order:
;Task: Given the input: <b><i>"amare"</i></b>, output the following, each on its own line:
<pre>
1st person singular
amo
2nd person singular
amas
3rd person singular
amat
1st person plural
amamus
2nd person plural
amatis
3rd person plural
amant
</pre>
 
* Each should be on its own line.
* Have at least one example from each of the 4 conjugations.
* Irregular verbs are not required.
* Translation into English is optional.
 
 
Line 21 ⟶ 26:
*[[wp:Latin_conjugation|Wikipedia: Latin conjugation]].
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<syntaxhighlight lang="11l">F conjugate(infinitive)
I !(infinitive[(len)-3..] == ‘are’)
print(‘'’infinitive"' non prima coniugatio verbi.\n")
R
 
V stem = infinitive[0 .< (len)-3]
I stem.empty
print("\'"infinitive"\' non satis diu conjugatus\n")
R
 
print(‘Praesens indicativi temporis of '’infinitive‘':’)
L(ending) (‘o’, ‘as’, ‘at’, ‘amus’, ‘atis’, ‘ant’)
print(‘ ’stem‘’ending)
print()
 
L(infinitive) (‘amare’, ‘dare’, ‘qwerty’, ‘are’)
conjugate(infinitive)</syntaxhighlight>
 
{{out}}
<pre>
Praesens indicativi temporis of 'amare':
amo
amas
amat
amamus
amatis
amant
 
Praesens indicativi temporis of 'dare':
do
das
dat
damus
datis
dant
 
'qwerty' non prima coniugatio verbi.
 
'are' non satis diu conjugatus
 
</pre>
 
=={{header|ALGOL 68}}==
<langsyntaxhighlight lang="algol68">BEGIN # print some Latin verb conjugations #
PROC s length = ( STRING s )INT: ( UPB s + 1 ) - LWB s; # calculates the length of s #
# prints the cojugations of lv or an error message if we don't know how to conjugate lv #
PROC print conjugations = ( STRING lv )VOID:
IF INT[]STRING lengthending = ( UPB lv= +( 1"are", )"ēre", -"ere", LWB"ire" lv);
INT length = s length( <lv 4);
INT conjugation := 0;
INT ending length := 0;
BOOL long enough := FALSE;
FOR i FROM LWB ending TO UPB ending WHILE conjugation = 0 DO
ending length := s length( ending[ i ] );
IF ending length < length
THEN
# the word is long enough for at least one ending #
long enough := TRUE;
IF lv[ ( UPB lv + 1 ) - ending length : ] = ending[ i ]
THEN
conjugation := i
FI
FI
OD;
NOT long enough
THEN
print( ( """", lv, """ is toonot long shortenough to conjugate", newline ) )
ELIF lv[conjugation UPB lv - 2 : ] /= "are"0
THEN
print( ( "Don't know how to conjugate """, lv, """", newline ) )
ELSE
[,]STRING suffix = ( ( "o", "as", "at", "amus", "atis", "ant" );
STRING prefix = lv[ : UPB lv - 2 ]; , ( "eo", "es", "et", "emus", "etis", "ent" )
print( ( "Conjugations of , ( "o", "is", lv"it", "imus", ":itis", newline )"unt" );
, ( "io", "is", "it", "imus", "itis", "iunt" )
FOR i FROM LWB suffix TO UPB suffix DO
print( ( " ", prefix, suffix[ i ], newline ) );
STRING prefix = lv[ : UPB lv - ending length ];
print( ( " Conjugations of """, lv, """:", newline ) );
FOR i FROM 2 LWB suffix TO 2 UPB suffix DO
print( ( " ", prefix, suffix[ conjugation, i ], newline ) )
OD
FI # print confugations # ;
print( conjugations( "amarePresent Indicative conjugation:", newline ) );
print conjugations( "veniamare" );
print conjugations( "daremonēre" );
print conjugations( "aretegere" );
print conjugations( "venire" );
END</lang>
print conjugations( "qwerty" );
print conjugations( "are" )
END
</syntaxhighlight>
{{out}}
<pre>
Present Indicative conjugation:
Conjugations of "amare":
amo
amas
amat
amamus
amatis
amant
Conjugations of "monēre":
moneo
mones
monet
monemus
monetis
monent
Conjugations of "tegere":
tego
tegis
tegit
tegimus
tegitis
tegunt
Conjugations of "venire":
venio
venis
venit
venimus
venitis
veniunt
Don't know how to conjugate "qwerty"
"are" is not long enough to conjugate
</pre>
 
=={{header|Arturo}}==
{{trans|Nim}}
<syntaxhighlight lang="rebol">endings: #[
{are}: ["o" "as" "at" "amus" "atis" "ant"]
{ēre}: ["eo" "es" "et" "emus" "etis" "ent"]
{ere}: ["o" "is" "it" "imus" "itis" "unt"]
{ire}: ["io" "is" "it" "imus" "itis" "iunt"]
]
 
conjugate: function [v][
suff: join last.n:3 split v
stem: slice v 0 (size v)-4
 
map endings\[suff] 'x -> stem ++ x
]
 
loop ["amare" "vidēre" "ducere" "audire"] 'verb [
print repeat "=" 20
print verb
print repeat "=" 20
loop conjugate verb 'row [
print row
]
print ""
]</syntaxhighlight>
 
{{out}}
 
<pre>====================
amare
====================
amo
amas
amat
amamus
amatis
amant
 
====================
vidēre
====================
video
vides
videt
videmus
videtis
vident
 
====================
ducere
====================
duco
ducis
ducit
ducimus
ducitis
ducunt
 
====================
audire
====================
audio
audis
audit
audimus
auditis
audiunt</pre>
=={{header|AWK}}==
{{works with|gawk|5.1.0 }}
<syntaxhighlight lang="AWK">
#!/usr/bin/env -S gawk -f
 
BEGIN {
ENDINGS["āre"]=1
ENDINGS["are"]=1
ENDINGS["ēre"]=2
ENDINGS["ere"]=3
ENDINGS["īre"]=4
ENDINGS["ire"]=4
first_person_singular=1
RULE[first_person_singular][1]="ō"
RULE[first_person_singular][2]="eō"
RULE[first_person_singular][3]="ō"
RULE[first_person_singular][4]="iō"
second_person_singular=2
RULE[second_person_singular][1]="ās"
RULE[second_person_singular][2]="ēs"
RULE[second_person_singular][3]="is"
RULE[second_person_singular][4]="īs"
third_person_singular=3
RULE[third_person_singular][1]="at"
RULE[third_person_singular][2]="et"
RULE[third_person_singular][3]="it"
RULE[third_person_singular][4]="it"
first_person_plural=4
RULE[first_person_plural][1]="āmus"
RULE[first_person_plural][2]="ēmus"
RULE[first_person_plural][3]="imus"
RULE[first_person_plural][4]="īmus"
second_person_plural=5
RULE[second_person_plural][1]="ātis"
RULE[second_person_plural][2]="ētis"
RULE[second_person_plural][3]="itis"
RULE[second_person_plural][4]="ītis"
third_person_plural=6
RULE[third_person_plural][1]="ant"
RULE[third_person_plural][2]="ent"
RULE[third_person_plural][3]="unt"
RULE[third_person_plural][4]="iunt"
print \
"infinitive│ ╭─person─╮ ╭─person─╮ \n"\
" │╭─────────── singular ──────────╮╭────────── plural ────────────╮\n"\
" ││ 1st 2nd 3rd ││ 1st 2nd 3rd │"
 
}
 
NF==0 || $1=="#" || index($1,"#")==1 {next}
 
1 {
printf "%-12s", $1
stem=substr($1,1,length($1)-3)
if (stem=="") { printf "%s\n", "* Can not conjugate"; next }
endn=substr($1,length($1)-2)
if (endn in ENDINGS) {
kind=ENDINGS[endn]
printf "%-11s", stem RULE[first_person_singular][kind]
printf "%-11s", stem RULE[second_person_singular][kind]
printf "%-11s", stem RULE[third_person_singular][kind]
printf "%-11s", stem RULE[first_person_plural][kind]
printf "%-11s", stem RULE[second_person_plural][kind]
printf "%-11s", stem RULE[third_person_plural][kind]
}
else {
printf "%s", "* Can not conjugate"
}
printf "\n"
next
}
</syntaxhighlight>
Run, assuming the code is in the <tt>clv.awk</tt>
<syntaxhighlight lang="shell">
#!/bin/sh
 
printf '
# "āre" Verbs (1st Conjugation):
amare (to love)
laudare (to praise)
vocare (to call)
 
# "ēre" Verbs (2nd Conjugation):
vidēre (to see)
docēre (to teach)
legere (to read)
 
# "ere" Verbs (3rd Conjugation):
ducere (to lead)
capere (to take)
facere (to do/make)
 
# "īre" Verbs (4th Conjugation):
audire (to hear)
venire (to come)
ire (to go)
 
# incorrect verbs
qwerty
 
' '' | LANG=en_US.UTF-8 gawk -f ./clv.awk
</syntaxhighlight>
{{out}}
<pre>
infinitive│ ╭─person─╮ ╭─person─╮
│╭─────────── singular ──────────╮╭────────── plural ────────────╮
││ 1st 2nd 3rd ││ 1st 2nd 3rd │
amare amō amās amat amāmus amātis amant
laudare laudō laudās laudat laudāmus laudātis laudant
vocare vocō vocās vocat vocāmus vocātis vocant
vidēre videō vidēs videt vidēmus vidētis vident
docēre doceō docēs docet docēmus docētis docent
legere legō legis legit legimus legitis legunt
ducere ducō ducis ducit ducimus ducitis ducunt
capere capō capis capit capimus capitis capunt
facere facō facis facit facimus facitis facunt
audire audiō audīs audit audīmus audītis audiunt
venire veniō venīs venit venīmus venītis veniunt
ire * Can not conjugate
qwerty * Can not conjugate
</pre>
=={{header|BQN}}==
{{trans|Nim}}
<syntaxhighlight lang="bqn">end←⟨"are","ēre","ere","ire"⟩
eCnj←⟨
⟨"o","as","at","amus","atis","ant"⟩
⟨"eo","es","et","emus","etis","ent"⟩
⟨"o","is","it","imus","itis","unt"⟩
⟨"io","is","it","imus","itis","iunt"⟩
Conj←{(¯3↓𝕩)⊸∾¨eCnj⊑˜⊑end⊐<¯3↑𝕩}
 
•Show >⋈⟜Conj¨⟨"amare","vidēre","ducere","audire"⟩</syntaxhighlight>
<syntaxhighlight>┌─
╵ "amare" ⟨ "amo" "amas" "amat" "amamus" "amatis" "amant" ⟩
"vidēre" ⟨ "video" "vides" "videt" "videmus" "videtis" "vident" ⟩
"ducere" ⟨ "duco" "ducis" "ducit" "ducimus" "ducitis" "ducunt" ⟩
"audire" ⟨ "audio" "audis" "audit" "audimus" "auditis" "audiunt" ⟩
┘</syntaxhighlight>
 
=={{header|EasyLang}}==
<syntaxhighlight>
proc conj inf$ . .
if substr inf$ -3 3 <> "are"
print "Not a first conjugation verb."
return
.
stem$ = substr inf$ 1 (len inf$ - 3)
if stem$ = ""
print "Stem cannot be empty."
return
.
print "Present indicative tense of " & inf$ & ":"
for en$ in [ "o" "as" "at" "amus" "atis" "ant" ]
print stem$ & en$
.
.
for s$ in [ "amare" "dare" ]
conj s$
print ""
.
</syntaxhighlight>
 
=={{header|EMal}}==
<syntaxhighlight lang="emal">
List patterns = List[
text["ō", "ās", "ăt", "āmus", "ātis", "ant"],
text["ěō", "ēs", "ĕt", "ēmus", "ētis", "ent"],
text["ō", "ĭs", "ĭt", "ĭmus", "ĭtis", "unt"],
text["ĭō", "īs", "it", "īmus", "ītis", "ĭunt"]]
fun getVerbInfo = Pair by text verb
if verb.endsWith("āre") do return int%text(0 => verb.replace("āre", ""))
else if verb.endsWith("ēre") do return int%text(1 => verb.replace("ēre", ""))
else if verb.endsWith("ĕre") do return int%text(2 => verb.replace("ĕre", ""))
else if verb.endsWith("īre") do return int%text(3 => verb.replace("īre", ""))
else do error(1, "unknown coniugation")
end
end
fun coniugatePresentActive = void by Pair verbInfo
for each text pattern in patterns[verbInfo.key]
writeLine(verbInfo.value + pattern)
end
end
List verbs = text["laudāre", "monēre", "legĕre", "audīre"]
for each text verb in verbs
writeLine("Praesens indicativi temporis of '" + verb + "':")
coniugatePresentActive(getVerbInfo(verb))
end
</syntaxhighlight>
{{out}}
<pre>
Praesens indicativi temporis of 'laudāre':
Conjugations of "amare":
laudō
amao
laudās
amaas
laudăt
amaat
laudāmus
amaamus
laudātis
amaatis
laudant
amaant
Praesens indicativi temporis of 'monēre':
Don't know how to conjugate "veni"
moněō
Conjugations of "dare":
monēs
dao
monĕt
daas
monēmus
daat
monētis
daamus
monent
daatis
Praesens indicativi temporis of 'legĕre':
daant
legō
"are" is too short to conjugate
legĭs
legĭt
legĭmus
legĭtis
legunt
Praesens indicativi temporis of 'audīre':
audĭō
audīs
audit
audīmus
audītis
audĭunt
</pre>
 
=={{header|F_Sharp|F#}}==
<langsyntaxhighlight lang="fsharp">
// Conjugate a Latin Verb. Nigel Galloway: September 17th., 2021
let myLatin (n:string)=printfn "Rogatus sum iungere verbum %s" n
Line 74 ⟶ 459:
|_->["o";"as";"at";"amus";"atis";"ant"]|>List.iter(fun g->printfn " %s%s" n.[0.. -4] g)
myLatin "amare"
myLatin "executiocreo"
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 85 ⟶ 470:
amatis
amant
Rogatus sum iungere verbum executiocreo
facis quod
</pre>
Line 91 ⟶ 476:
=={{header|Factor}}==
{{works with|Factor|0.99 2021-06-02}}
<langsyntaxhighlight lang="factor">USING: formatting io kernel math qw sequences ;
 
CONSTANT: pronouns {
Line 133 ⟶ 518:
 
"amāre" "love" conjugate. nl
"dāre" "give" conjugate.</langsyntaxhighlight>
{{out}}
<pre>
Line 152 ⟶ 537:
dant they give
</pre>
 
=={{header|FreeBASIC}}==
{{trans|Wren}}
<syntaxhighlight lang="freebasic">Sub conjugate(infinitive As String)
Dim As String ending(1 To 6) => {"o", "as", "at", "amus", "atis", "ant"}
If Not (Right(infinitive, 3) = "are") Then Print "'"; infinitive; !"' non prima coniugatio verbi.\n" : Exit Sub
Dim As String stem = Left(infinitive, Len(infinitive)-3)
If Len(stem) = 0 Then Print !"\'"; infinitive; !"\' non satis diu conjugatus\n" : Exit Sub
 
Print Using "Praesens indicativi temporis of '&':"; infinitive
For i As Byte = 1 To 6
Print Spc(5); stem; ending(i)
Next i
Print
End Sub
 
conjugate("amare")
conjugate("dare")
conjugate("qwerty")
conjugate("are")
Sleep</syntaxhighlight>
{{out}}
<pre>Praesens indicativi temporis of 'amare':
amo
amas
amat
amamus
amatis
amant
 
Praesens indicativi temporis of 'dare':
do
das
dat
damus
datis
dant
 
'qwerty' non prima coniugatio verbi.
 
'are' non satis diu conjugatus</pre>
 
=={{header|Go}}==
{{trans|Wren}}
The 'extended' version.
<syntaxhighlight lang="go">package main
 
import (
"fmt"
"log"
)
 
var endings = [][]string{
{"o", "as", "at", "amus", "atis", "ant"},
{"eo", "es", "et", "emus", "etis", "ent"},
{"o", "is", "it", "imus", "itis", "unt"},
{"io", "is", "it", "imus", "itis", "iunt"},
}
 
var infinEndings = []string{"are", "ēre", "ere", "ire"}
 
var pronouns = []string{"I", "you (singular)", "he, she or it", "we", "you (plural)", "they"}
 
var englishEndings = []string{"", "", "s", "", "", ""}
 
func conjugate(infinitive, english string) {
letters := []rune(infinitive)
le := len(letters)
if le < 4 {
log.Fatal("Infinitive is too short for a regular verb.")
}
infinEnding := string(letters[le-3:])
conj := -1
for i, s := range infinEndings {
if s == infinEnding {
conj = i
break
}
}
if conj == -1 {
log.Fatalf("Infinitive ending -%s not recognized.", infinEnding)
}
stem := string(letters[:le-3])
fmt.Printf("Present indicative tense, active voice, of '%s' to '%s':\n", infinitive, english)
for i, ending := range endings[conj] {
fmt.Printf(" %s%-4s %s %s%s\n", stem, ending, pronouns[i], english, englishEndings[i])
}
fmt.Println()
}
 
func main() {
pairs := [][2]string{{"amare", "love"}, {"vidēre", "see"}, {"ducere", "lead"}, {"audire", "hear"}}
for _, pair := range pairs {
conjugate(pair[0], pair[1])
}
}</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>
 
=={{header|jq}}==
{{trans|Wren}}
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
 
====Part 1====
<syntaxhighlight lang="jq">def conjugate:
if endswith("are") | not
then "\(.) is not a first conjugation verb." | error
else .[0:-3] as $stem
| if $stem|length == 0 then "Stem cannot be empty." | error
else "Present indicative tense of '\(.)':",
( "o", "as", "at", "amus", "atis", "ant"
| " " + $stem + .),
""
end
end;
 
("amare", "dare")
| conjugate</syntaxhighlight>
{{out}}
As for [[#Wren]].
 
====Part 2====
<syntaxhighlight lang="text">def rpad($len): tostring | ($len - length) as $l | . + (" " * $l)[:$l];
 
def 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"]
];
def infinEndings: ["are", "ēre", "ere", "ire"];
def pronouns: ["I", "you (singular)", "he, she or it", "we", "you (plural)", "they"];
def englishEndings: [ "", "", "s", "", "", "" ];
def conjugate($infinitive; $english):
def letters: [explode[] | [.] | implode];
($infinitive|letters) as $letters
| if $letters|length < 4 then "Infinitive is too short for a regular verb." | error
else ($letters[-3:]|join("")) as $infinEnding
| (infinEndings | index($infinEnding)) as $conj
| if $conj == null then "Infinitive ending -\($infinEnding) not recognized." | error
else ($letters[:-3]|join("")) as $stem
| "Present indicative tense, active voice, of '\(infinitive)' to '\($english)':",
foreach endings[$conj][] as $ending (-1; .+1;
" \($stem + $ending|rpad(8)) \(pronouns[.]) \($english)\(englishEndings[.])" )
end
end;
def pairs: [["amare", "love"], ["vidēre", "see"], ["ducere", "lead"], ["audire", "hear"]];
 
pairs[]
| conjugate(.[0]; .[1])</syntaxhighlight>
{{out}}
As for [[#Wren]].
 
=={{header|Julia}}==
<langsyntaxhighlight lang="julia">const conjugators = ["ō", "ās", "at", "āmus", "ātis", "ant"]
conjugate(w, gregex = r"[aā]re$") = (r = replace(w, gregex => ""); [r * s for s in conjugators])
 
Line 166 ⟶ 745:
end
 
testregularconjugation(["amāre", "dāredare"])
</langsyntaxhighlight>{{out}}
<pre>
Present active indicative conjugation of amāre:
Line 177 ⟶ 756:
amant
 
Present active indicative conjugation of dāredare:
dās
Line 185 ⟶ 764:
dant
</pre>
 
=={{header|Koka}}==
{{trans|Ruby}}
<syntaxhighlight lang="koka">
effect yield<a>
ctl yield(a: a): ()
 
fun conjugate(infinitive: string)
if infinitive.count < 4 then
yield("Can not conjugate \"" ++ infinitive ++ "\" not long enough for a regular verb")
return ()
val ending = infinitive.last(3)
val conjugations = match ending.string
"are" -> ["o", "as", "at", "amus", "atis", "ant"]
"ēre" -> ["eo", "es", "et", "emus", "etis", "ent"]
"ere" -> ["o", "is", "it", "imus", "itis", "unt"]
"ire" -> ["io", "is", "it", "imus", "itis", "iunt"]
_ ->
yield("Can not conjugate \"" ++ infinitive ++ "\" not a regular verb ending")
[]
val root = ending.before.string
conjugations.foreach fn(c)
yield(root ++ c)
 
fun main()
with handler
fun yield(a: string)
println(a)
["amare", "vidēre", "ducere", "audire", "qwerty", "are"].foreach fn(word)
(word ++ ":").println
word.conjugate
</syntaxhighlight>
 
{{out}}
<pre>
amare:
amo
amas
amat
amamus
amatis
amant
vidēre:
video
vides
videt
videmus
videtis
vident
ducere:
duco
ducis
ducit
ducimus
ducitis
ducunt
audire:
audio
audis
audit
audimus
auditis
audiunt
qwerty:
Can not conjugate "qwerty" not a regular verb ending
are:
Can not conjugate "are" not long enough for a regular verb
</pre>
=={{header|Nim}}==
{{trans|Go}}
{{Works with|Nim|1.6.0}}
<syntaxhighlight lang="nim">import std/[strformat, unicode]
 
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"]]
InfinEndings = ["are", "ēre", "ere", "ire"]
Pronouns = ["I", "you (singular)", "he, she or it", "we", "you (plural)", "they"]
EnglishEndings = ["", "", "s", "", "", ""]
 
 
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()
 
 
for (infinitive, english) in {"amare": "love", "vidēre": "see", "ducere": "lead", "audire": "hear"}:
conjugate(infinitive, english)</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>
 
=={{header|Perl}}==
{{trans|Raku}}
<langsyntaxhighlight lang="perl">use strict;
use warnings;
use feature 'say';
Line 203 ⟶ 915:
my($verb) = $infinitive =~ /^ (\w+) [aā] re $/x;
say $verb ? conjugate $verb : "Sorry, don't know how to conjugate $infinitive"
</syntaxhighlight>
</lang>
{{out}}
<pre>Present active indicative conjugation of infinitive amāre.
Line 223 ⟶ 935:
=={{header|Phix}}==
TL; DR: Did just one term of Latin, right before posting this realised 'dāre' should probably be 'dare', left as an exercise...
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">constant</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">ending</span><span style="color: #0000FF;">,</span><span style="color: #000000;">endings</span><span style="color: #0000FF;">}</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">columnize</span><span style="color: #0000FF;">({{</span><span style="color: #008000;">"āre"</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">split</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"ō ās at āmus ātis ant"</span><span style="color: #0000FF;">)},</span>
Line 250 ⟶ 962:
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,</span><span style="color: #008000;">""</span><span style="color: #0000FF;">,{</span><span style="color: #008000;">"unicode_align"</span><span style="color: #0000FF;">,</span><span style="color: #004600;">true</span><span style="color: #0000FF;">})</span>
<span style="color: #7060A8;">papply</span><span style="color: #0000FF;">({{</span><span style="color: #008000;">"amāre"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"love"</span><span style="color: #0000FF;">},{</span><span style="color: #008000;">"dāre"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"give"</span><span style="color: #0000FF;">},{</span><span style="color: #008000;">"vidēre"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"see"</span><span style="color: #0000FF;">},{</span><span style="color: #008000;">"dūcere"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"lead"</span><span style="color: #0000FF;">},{</span><span style="color: #008000;">"audīre"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"hear"</span><span style="color: #0000FF;">}},</span><span style="color: #000000;">conjugate</span><span style="color: #0000FF;">)</span>
<!--</langsyntaxhighlight>-->
{{out}}
<pre>
Line 293 ⟶ 1,005:
  audiunt  they hear
</pre>
 
=={{header|Phixmonti}}==
<syntaxhighlight lang="Phixmonti">/# Rosetta Code problem: http://rosettacode.org/wiki/Conjugate_a_Latin_verb
by Galileo, 10/2022 #/
 
include ..\Utilitys.pmt
 
( ( "are" "ere" "ire" )
( ( "o" "as" "at" "amus" "atis" "ant" )
( "o" "is" "it" "imus" "itis" "unt" )
( "io" "is" "it" "imus" "itis" "iunt" ) ) )
 
( "amare" "ducere" "audire" ) len for
get dup print ":" ?
len 2 - snip swap >ps rot swap
getd
len for
get tps swap chain ?
endfor
cps drop swap nl
endfor
</syntaxhighlight>
 
{{out}}<pre>
amare:
amo
amas
amat
amamus
amatis
amant
 
ducere:
duco
ducis
ducit
ducimus
ducitis
ducunt
 
audire:
audio
audis
audit
audimus
auditis
audiunt
 
=== Press any key to exit ===
</pre>
 
=={{header|Python}}==
{{trans|Wren}}
<syntaxhighlight lang="python">#!/usr/bin/python
 
def conjugate(infinitive):
if not infinitive[-3:] == "are":
print("'", infinitive, "' non prima coniugatio verbi.\n", sep='')
return False
stem = infinitive[0:-3]
if len(stem) == 0:
print("\'", infinitive, "\' non satis diu conjugatus\n", sep='')
return False
 
print("Praesens indicativi temporis of '", infinitive, "':", sep='')
for ending in ("o", "as", "at", "amus", "atis", "ant"):
print(" ", stem, ending, sep='')
print()
if __name__ == '__main__':
for infinitive in ("amare", "dare", "qwerty", "are"):
conjugate(infinitive)</syntaxhighlight>
 
=={{header|Raku}}==
Translation of {{trans|Julia. }}
 
<syntaxhighlight lang="raku" perl6line>for <amāre dare> -> $infinitive {
say "\nPresent active indicative conjugation of infinitive $infinitive.";
my $verb = ($infinitive ~~ /^ (\w+) ['a'|'ā'] 're' $/)[0];
Line 303 ⟶ 1,090:
}
 
sub conjugate ($verb) { ($verb X~ <ō ās at āmus ātis ant>).join: "\n" }</langsyntaxhighlight>
{{out}}
<pre>Present active indicative conjugation of infinitive amāre.
Line 323 ⟶ 1,110:
=={{header|REXX}}==
Checks were also made to ensure the Latin verb has only Latin letters (upper and/or lower case).
<langsyntaxhighlight lang="rexx">/*REXX pgm conjugates (to the terminal) a Latin verb when given a first conjugation verb*/
parse arg verbs
if verbs='' | verbs="," then verbs= 'amare dare'
Line 345 ⟶ 1,132:
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
ser: say; say '***error*** ' arg(1); say; exit 13</langsyntaxhighlight>
{{out|output|text=&nbsp; when using the default inputs:}}
<pre>
Line 364 ⟶ 1,151:
datis
dant
</pre>
 
=={{header|RPL}}==
≪ DUP SIZE
DUP2 "aEei" ROT ROT 2 - DUP SUB POS
→ verb length group
≪ '''IF''' group length 3 > AND verb length 1 - length SUB "re" == AND '''THEN'''
{ }
1 6 '''FOR''' t
verb 1 length 3 - SUB
'''IF''' t 1 == '''THEN'''
{ "" "e" "" "i" } group GET + "o" +
'''ELSE'''
{ "a" "e" "i" "i" } group GET +
'''IF''' t 6 == '''THEN'''
'''IF''' group 3 == '''THEN''' 1 OVER SIZE 1 - SUB '''END'''
'''IF''' group 2 > '''THEN''' "u" + '''END'''
'''END'''
{ "" "s" "t" "mus" "tis" "nt" } t GET +
'''END'''
+
'''NEXT'''
'''ELSE''' "Can't conjugate " verb + '''END'''
≫ ≫ '<span style="color:blue">CONJV</span>' STO
 
≪ { "amare" "vidEre" "tegere" "venire" "abcdef" } → cases
≪ {} 1 cases SIZE '''FOR''' j cases j GET <span style="color:blue">CONJV</span> '''NEXT''' ≫ ≫ EVAL
{{out}}
<pre>
5: { "amo" "amas" "amat" "amamus" "amatis" "amant" }
4: { "video" "vides" "videt" "videmus" "videtis" "vident" }
3: { "tego" "tegis" "tegit" "tegimus" "tegitis" "tegunt" }
2: { "audio" "audis" "audit" "audimus" "auditis" "audiunt" }
1: "Can't conjugate abcdef"
</pre>
 
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">def conjugate(infinitive)
return ["Can not conjugate #{infinitive}"] if infinitive.size < 4
conjugations = case infinitive[-3..-1]
when "are" then ["o", "as", "at", "amus", "atis", "ant"]
when "ēre" then ["eo", "es", "et", "emus", "etis", "ent"]
when "ere" then ["o", "is", "it", "imus", "itis", "unt"]
when "ire" then ["io", "is", "it", "imus", "itis", "iunt"]
else return ["Can not conjugate #{infinitive}"]
end
conjugations.map{|c| infinitive[0..-4] + c}
end
 
["amare", "vidēre", "ducere", "audire","qwerty", "are"].each do |inf|
puts "\n" + inf + ":"
puts conjugate inf
end
</syntaxhighlight>
{{out}}
<pre>
amare:
amo
amas
amat
amamus
amatis
amant
 
vidēre:
video
vides
videt
videmus
videtis
vident
 
ducere:
duco
ducis
ducit
ducimus
ducitis
ducunt
 
audire:
audio
audis
audit
audimus
auditis
audiunt
 
qwerty:
Can not conjugate qwerty
 
are:
Can not conjugate are
</pre>
 
=={{header|V (Vlang)}}==
{{trans|Go}}
The 'extended' version.
<syntaxhighlight lang="v (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>
 
=={{header|Wren}}==
<langsyntaxhighlight ecmascriptlang="wren">var conjugate = Fn.new { |infinitive|
if (!infinitive.endsWith("are")) Fiber.abort("Not a first conjugation verb.")
var stem = infinitive[0...-3]
Line 378 ⟶ 1,352:
}
 
for (infinitive in ["amare", "dare"]) conjugate.call(infinitive)</langsyntaxhighlight>
 
{{out}}
Line 399 ⟶ 1,373:
</pre>
<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 = [
<syntaxhighlight lang="wren">import "./fmt" for Fmt
 
var endings = [
[ "o", "as", "at", "amus", "atis", "ant"],
["eo", "es", "et", "emus", "etis", "ent"],
Line 409 ⟶ 1,386:
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
if (letters.count < 4) Fiber.abort("Infinitive is too short for a regular verb.")
Line 416 ⟶ 1,397:
if (conj == -1) Fiber.abort("Infinitive ending -%(infinEnding) not recognized.")
var stem = letters[0..-4].join()
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()
}
 
forvar (infinitivepairs in= [["amare", "love"], ["vidēre", "see"], ["ducere", "audirelead"]), conjugate.call(infinitive)</lang>["audire", "hear"]]
for (pair in pairs) conjugate.call(pair[0], pair[1])</syntaxhighlight>
 
{{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 '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>
1,981

edits