Conjugate a Latin verb
Basic Data Operation
This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:
Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |
Comparison |
Matching
Memory Operations
Pointers & references |
Addresses
- Task
- Given the input: "amare", output the following, each on its own line:
amo amas amat amamus amatis amant
- Metrics
- Counting
- Word frequency
- Letter frequency
- Jewels and stones
- I before E except after C
- Bioinformatics/base count
- Count occurrences of a substring
- Count how many vowels and consonants occur in a string
- Remove/replace
- XXXX redacted
- Conjugate a Latin verb
- Remove vowels from a string
- String interpolation (included)
- Strip block comments
- Strip comments from a string
- Strip a set of characters from a string
- Strip whitespace from a string -- top and tail
- Strip control codes and extended characters from a string
- Anagrams/Derangements/shuffling
- Word wheel
- ABC problem
- Sattolo cycle
- Knuth shuffle
- Ordered words
- Superpermutation minimisation
- Textonyms (using a phone text pad)
- Anagrams
- Anagrams/Deranged anagrams
- Permutations/Derangements
- Find/Search/Determine
- ABC words
- Odd words
- Word ladder
- Semordnilap
- Word search
- Wordiff (game)
- String matching
- Tea cup rim text
- Alternade words
- Changeable words
- State name puzzle
- String comparison
- Unique characters
- Unique characters in each string
- Extract file extension
- Levenshtein distance
- Palindrome detection
- Common list elements
- Longest common suffix
- Longest common prefix
- Compare a list of strings
- Longest common substring
- Find common directory path
- Words from neighbour ones
- Change e letters to i in words
- Non-continuous subsequences
- Longest common subsequence
- Longest palindromic substrings
- Longest increasing subsequence
- Words containing "the" substring
- Sum of the digits of n is substring of n
- Determine if a string is numeric
- Determine if a string is collapsible
- Determine if a string is squeezable
- Determine if a string has all unique characters
- Determine if a string has all the same characters
- Longest substrings without repeating characters
- Find words which contains all the vowels
- Find words which contains most consonants
- Find words which contains more than 3 vowels
- Find words which first and last three letters are equals
- Find words which odd letters are consonants and even letters are vowels or vice_versa
- Formatting
- Substring
- Rep-string
- Word wrap
- String case
- Align columns
- Literals/String
- Repeat a string
- Brace expansion
- Brace expansion using ranges
- Reverse a string
- Phrase reversals
- Comma quibbling
- Special characters
- String concatenation
- Substring/Top and tail
- Commatizing numbers
- Reverse words in a string
- Suffixation of decimal numbers
- Long literals, with continuations
- Numerical and alphabetical suffixes
- Abbreviations, easy
- Abbreviations, simple
- Abbreviations, automatic
- Song lyrics/poems/Mad Libs/phrases
- Mad Libs
- Magic 8-ball
- 99 Bottles of Beer
- The Name Game (a song)
- The Old lady swallowed a fly
- The Twelve Days of Christmas
- Tokenize
- Text between
- Tokenize a string
- Word break problem
- Tokenize a string with escaping
- Split a character string based on change of character
- Sequences
- See also
ALGOL 68
<lang algol68>BEGIN # print some Latin verb conjugations #
# 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 length = ( UPB lv + 1 ) - LWB lv; length < 4 THEN print( ( """", lv, """ is too short to conjugate", newline ) ) ELIF lv[ UPB lv - 2 : ] /= "are" 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 ]; print( ( "Conjugations of """, lv, """:", newline ) ); FOR i FROM LWB suffix TO UPB suffix DO print( ( " ", prefix, suffix[ i ], newline ) ) OD FI # print confugations # ; print conjugations( "amare" ); print conjugations( "veni" ); print conjugations( "dare" ); print conjugations( "are" )
END</lang>
- Output:
Conjugations of "amare": amao amaas amaat amaamus amaatis amaant Don't know how to conjugate "veni" Conjugations of "dare": dao daas daat daamus daatis daant "are" is too short to conjugate
Factor
<lang factor>USING: formatting io kernel math qw sequences ;
CONSTANT: pronouns {
"I" "you (singular)" "he, she, it" "we" "you (plural)" "they"
}
CONSTANT: endings qw{ ō ās at āmus ātis ant }
- first-conjugation? ( str -- ? )
qw{ are āre } [ tail? ] with any? ;
- check-first-conjugation ( str -- )
first-conjugation? [ "Input must end with 'are' or 'āre'." throw ] unless ;
- check-length ( str -- )
length 3 > [ "Input too short to conjugate." throw ] unless ;
- check-input ( str -- )
[ check-first-conjugation ] [ check-length ] bi ;
- conjugate ( str -- seq )
dup check-input 3 head* endings [ append ] with map ;
- conjugate. ( str -- )
dup "Present active indicative conjugations of %s:\n" printf pronouns swap conjugate [ " %-16s%s\n" printf ] 2each ;
"amāre" conjugate. nl "dāre" conjugate.</lang>
- Output:
Present active indicative conjugations of amāre: I amō you (singular) amās he, she, it amat we amāmus you (plural) amātis they amant Present active indicative conjugations of dāre: I dō you (singular) dās he, she, it dat we dāmus you (plural) dātis they dant
REXX
Checks were also made to ensure the Latin verb has only Latin letters (upper and/or lower case). <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' suffix= 'o as at amus atis ant' /*a list of six Latin verb suffixes. */
- = words(verbs) /*obtain the # of Latin verbs specified*/
do j=1 for #; say /*process each " " " */ $= word(verbs, j); $$= $; upper $$ /*obtain one of the " " " */ if \datatype($, 'M') then call ser "the following isn't a Latin verb: " $ L= length($) /*obtain the length of a Latin verb. */ if L<4 then call ser 'length of Latin verb is too short: ' $ if right($$, 3)\=='ARE' then call ser "the following isn't a Latin verb: " $ stem= left($, length($) - 3) /*obtain the stem of the Latin verb. */ say center(' present indicative tense of "'$'"', 50, "─")
do k=1 for words(suffix) /*display each of the verb suffixes. */ say left(,21) stem || word(suffix, k) /*display a Latin verb stem with auffix*/ end /*k*/ say end /*j*/
exit 0 /*stick a fork in it, we're all done. */ /*──────────────────────────────────────────────────────────────────────────────────────*/ ser: say; say '***error*** ' arg(1); say; exit 13</lang>
- output when using the default inputs:
─────── present indicative tense of "amare"─────── amo amas amat amamus amatis amant ─────── present indicative tense of "dare"──────── do das dat damus datis dant
Wren
<lang ecmascript>var conjugate = Fn.new { |infinitive|
if (!infinitive.endsWith("are")) Fiber.abort("Not a first conjugation verb.") var stem = infinitive[0...-3] if (stem.count == 0) Fiber.abort("Stem cannot be empty.") System.print("Present indicative tense of '%(infinitive)':") for (ending in ["o", "as", "at", "amus", "atis", "ant"]) { System.print(" " + stem + ending) } System.print()
}
for (infinitive in ["amare", "dare"]) conjugate.call(infinitive)</lang>
- Output:
Present indicative tense of 'amare': amo amas amat amamus amatis amant Present indicative tense of 'dare': do das dat damus datis dant
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.
<lang ecmascript>var 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"]
]
var infinEndings = ["are", "ēre", "ere", "ire"]
var conjugate = Fn.new { |infinitive|
var letters = infinitive.toList if (letters.count < 4) Fiber.abort("Infinitive is too short for a regular verb.") var infinEnding = letters[-3..-1].join() var conj = infinEndings.indexOf(infinEnding) 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)':") for (ending in endings[conj]) System.print(" " + stem + ending) System.print()
}
for (infinitive in ["amare", "vidēre", "ducere", "audire"]) conjugate.call(infinitive)</lang>
- Output:
Present indicative tense, active voice, of 'amare': amo amas amat amamus amatis amant Present indicative tense, active voice, of 'vidēre': video vides videt videmus videtis vident Present indicative tense, active voice, of 'ducere': duco ducis ducit ducimus ducitis ducunt Present indicative tense, active voice, of 'audire': audio audis audit audimus auditis audiunt