Conjugate a Latin verb: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 615: | Line 615: | ||
</pre> |
</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}}== |
=={{header|Nim}}== |
||
{{trans|Go}} |
{{trans|Go}} |