Rebol3 Code Examplex
Conjugate a Latin verb
Rebol [
title: "Rosetta code: Conjugate a Latin verb"
file: %Conjugate_a_Latin_verb.r3
url: https://rosettacode.org/wiki/Conjugate_a_Latin_verb
]
conjugate: function/with [
"Print the present indicative conjugation of a Latin conjugation verb"
verb [string!]
][
st: skip tail verb -3
unless ends: endings/:st [
print [as-red verb "non prima coniugatio verbi!"]
exit
]
if head? st [
print [as-red verb "non satis diu conjugatus!"]
exit
]
st: copy/part verb st
print ["^/Praesens indicativi temporis of:" as-green verb]
foreach en ends [
print ajoin [" " st en]
]
][
endings: #[
"are" ["o" "as" "at" "amus" "atis" "ant" ]
"ere" ["o" "is" "it" "imus" "itis" "unt" ]
"ēre" ["eo" "es" "et" "emus" "etis" "ent" ]
"ire" ["io" "is" "it" "imus" "itis" "iunt"]
]
]
foreach verb ["amare" "venire" "monēre" "tegere" "are" "qwerty"][
conjugate verb
]Output:
Praesens indicativi temporis of: amare
amo
amas
amat
amamus
amatis
amant
Praesens indicativi temporis of: venire
venio
venis
venit
venimus
venitis
veniunt
Praesens indicativi temporis of: monēre
moneo
mones
monet
monemus
monetis
monent
Praesens indicativi temporis of: tegere
tego
tegis
tegit
tegimus
tegitis
tegunt
are non satis diu conjugatus!
qwerty non prima coniugatio verbi!