Conjugate a Latin verb: Difference between revisions

Add ed example
m (→‎{{header|Wren}}: Minor tidy (extended version))
(Add ed example)
 
(3 intermediate revisions by 2 users not shown)
Line 371:
 
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
proc conj inf$ . .
if substr inf$ len inf$ -3 2 -13 <> "are"
print "Not a first conjugation verb."
return
.
stem$ = substr inf$ 1 (len inf$ - 3)
if stem$ = ""
print "Stem cannot be empty."
Line 392:
.
</syntaxhighlight>
 
=={{header|ed}}==
 
Input file is supposed to have the infinitive verb as the only line.
 
<syntaxhighlight lang="sed">
H
p
t0
t0
t0
t0
t0
1s/(are|ere)$/o/
2s/are$/as/
3s/are$/at/
4s/are$/amus/
5s/are$/atis/
6s/are$/ant/
 
1s/ēre$/eo/
2s/ēre$/es/
3s/ēre$/et/
4s/ēre$/emus/
5s/ēre$/etis/
6s/ēre$/ent/
 
1s/ire$/io/
6s/ire$/iunt/
6s/ere$/unt/
 
2s/(ere|ire)$/is/
3s/(ere|ire)$/it/
4s/(ere|ire)$/imus/
5s/(ere|ire)$/itis/
,p
Q
</syntaxhighlight>
 
{{out}}
 
<pre>$ cat roman-conjugations.ed | ed -lEGs roman-conjugations.input
Newline appended
amare
...
amo
amas
amat
amamus
amatis
amant</pre>
 
=={{header|EMal}}==
Line 582 ⟶ 633:
'are' non satis diu conjugatus</pre>
 
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
include "NSLog.incl"
 
local fn Conjugate( infinitive as CFStringRef ) as CFArrayRef
if ( len(infinitive) < 4 ) then exit fn = @[fn StringWithFormat( @"[Can not conjugate %@.]", infinitive)]
CFStringRef conjugation
CFStringRef ending = fn StringSubstringFromIndex( infinitive, len(infinitive) - 3 )
CFMutableArrayRef conjugations = fn MutableArrayNew
CFMutableArrayRef result = fn MutableArrayNew
if fn StringIsEqual( ending, @"are" ) then MutableArrayAddObjectsFromArray( conjugations, @[@"o", @"as", @"at", @"amus", @"atis", @"ant"] )
if fn StringIsEqual( ending, @"ēre" ) then MutableArrayAddObjectsFromArray( conjugations, @[@"eo", @"es", @"et", @"emus", @"etis", @"ent"] )
if fn StringIsEqual( ending, @"ere" ) then MutableArrayAddObjectsFromArray( conjugations, @[@"o", @"is", @"it", @"imus", @"itis", @"unt"] )
if fn StringIsEqual( ending, @"ire" ) then MutableArrayAddObjectsFromArray( conjugations, @[@"io", @"is", @"it", @"imus", @"itis", @"iunt"] )
if fn ArrayCount( conjugations ) < 1 then exit fn = @[fn StringWithFormat( @"[Can not conjugate %@.]", infinitive )]
for conjugation in conjugations
MutableArrayAddObject( result, fn StringWithFormat( @"%@%@", fn StringSubstringToIndex( infinitive, len(infinitive) - 3 ), conjugation ) )
next
end fn = result
 
local fn DoConjugations
CFStringRef infinitive, conjugation
CFArrayRef infinitives = @[@"amare", @"videre", @"ducere", @"audire", @"qwerty", @"are"]
for infinitive in infinitives
NSLog( @"\nConjugation of: %@", infinitive )
CFArrayRef conjugations = fn Conjugate( infinitive )
for conjugation in conjugations
NSLog( @"%@", conjugation )
next
next
end fn
 
fn DoConjugations
 
HandleEvents
</syntaxhighlight>
<pre>
 
Conjugation of: amare
amo
amas
amat
amamus
amatis
amant
 
Conjugation of: videre
vido
vidis
vidit
vidimus
viditis
vidunt
 
Conjugation of: ducere
duco
ducis
ducit
ducimus
ducitis
ducunt
 
Conjugation of: audire
audio
audis
audit
audimus
auditis
audiunt
 
Conjugation of: qwerty
[Can not conjugate qwerty.]
 
Conjugation of: are
[Can not conjugate are.]
</pre>
=={{header|Go}}==
{{trans|Wren}}
100

edits