Exercise #5

In Latin, most nouns have case inflections: the ending of the noun depends both on the noun's number (singular or plural) and on its syntactic role (for instance, whether it is the subject, direct object, or indirect object of a verb). It is usual to distinguish six such cases -- the nominative, genitive, dative, accusative, ablative, and vocative cases -- each of which has distinct singular and plural forms.

The declension of a Latin noun is a table in which all of these forms are exhibited. Here, for instance, is the declension of the Latin noun amicus (``friend''):

singular plural
nominative amicus amici
genitive amici amicorum
dative amico amicis
accusative amicum amicos
ablative amico amicis
vocative amice amici

Many Latin nouns -- the ``regular masculine nouns of the second declension'' -- take endings similar to those of amicus. To obtain these forms, one removes the -us at the end of the (nominative singular) reference form to obtain the root, then appends the appropriate endings to the root:

singular plural
nominative -us -i
genitive -i -orum
dative -o -is
accusative -um -os
ablative -o -is
vocative -e -i

The exercise is to design, write, and test a Scheme procedure declension that takes one argument, which must be a string of letters ending in -us, and prints out a declension of that string, treating it as a regular masculine noun of the second declension. If the procedure is given an argument that does not end in -us or is not a string at all, it should invoke the error procedure to produce an appropriate error message.

Test your procedure on the following Latin nouns: campus (``field''), equus (``horse''), avus (``grandfather''), and grammaticus (``grammarian'').


This document is available on the World Wide Web as

http://www.math.grin.edu/courses/Scheme/fall-1997/exercise-5.html

created October 7, 1997
last revised November 6, 1997

John David Stone (stone@math.grin.edu)