Let's say that two authors were contemporaries just in case both of them were born before either of them died. Thus, for instance, Gabrielle D'Annunzio (1863-1938) was a contemporary of Flannery O'Connor (1935-1964), but not of Thomas Malory (d. 1471).
In this exercise, you will design, write, and test a Scheme procedure named
contemporaries that takes information about an author (in the
form of a three-element list comprising the author's surname, year of
birth, and year of death), searches through a database for contemporaries
of that author, and displays the surnames and pseudonyms of any
contemporaries that it finds.
Here is what a typical interaction with this procedure should look like. The user wishes to see a list of the contemporaries of Francis Bacon (1561-1626).
> (contemporaries '("Bacon" 1561 1626))
Bradstreet
Cervantes
Corneille
Donne
Jonson
Marlowe
Milton
Moliere
Montaigne
Ronsard
Shakespeare
Spenser
Here is a modest database containing the surnames or pseudonyms of various
authors and their dates of birth and death. Again, each surname is given
as a Scheme string literal and each date as a Scheme integer, and these
three data about each author are assembled into a list. The database is a
list of such three-element lists and is named list-of-authors.
You may include this definition in your program.
(define list-of-authors '(
("Ade" 1866 1944) ("Aiden" 1889 1973)
("Alcott" 1832 1888) ("Aleichem" 1859 1916)
("Aleixandre" 1898 1984) ("Alger" 1832 1899)
("Andersen" 1805 1875) ("Anderson" 1876 1941)
("Arnold" 1822 1888) ("Asimov" 1920 1992)
("Austen" 1775 1817) ("Babel" 1894 1941)
("Balzac" 1799 1850) ("Barrie" 1860 1937)
("Baudelaire" 1821 1867) ("Baum" 1856 1919)
("Beauvoir" 1908 1986) ("Beckett" 1906 1989)
("Behan" 1923 1964) ("Benchley" 1889 1945)
("Benet" 1898 1943) ("Berryman" 1914 1972)
("Bierce" 1842 1914) ("Blake" 1757 1827)
("Boccaccio" 1313 1375) ("Borges" 1900 1986)
("Boswell" 1740 1795) ("Boulle" 1913 1994)
("Bradstreet" 1612 1672) ("Brecht" 1898 1956)
("Bronte" 1816 1855) ("Browning" 1812 1889)
("Buck" 1892 1973) ("Bulgakov" 1891 1940)
("Bunyan" 1628 1688) ("Burgess" 1917 1993)
("Burns" 1759 1796) ("Burton" 1909 1968)
("Burroughs" 1875 1950) ("Byron" 1788 1824)
("Calvino" 1923 1985) ("Camus" 1913 1960)
("Capek" 1890 1938) ("Carroll" 1832 1898)
("Casanova" 1725 1798) ("Cather" 1873 1947)
("Cervantes" 1547 1616) ("Chandler" 1888 1959)
("Cheever" 1912 1982) ("Chekhov" 1860 1904)
("Chesterton" 1874 1936) ("Chopin" 1851 1904)
("Christie" 1890 1976) ("Clavell" 1925 1994)
("Cocteau" 1889 1963) ("Coleridge" 1772 1834)
("Colette" 1873 1954) ("Conrad" 1857 1924)
("Cooper" 1789 1851) ("Corneille" 1606 1684)
("Crane" 1871 1900) ("cummings" 1894 1962)
("Dahl" 1916 1990) ("Dante" 1265 1321)
("Defoe" 1660 1731) ("Dickens" 1812 1870)
("Dickinson" 1830 1886) ("Dinesen" 1885 1962)
("Donne" 1573 1631) ("Dostoyevsky" 1821 1881)
("Doyle" 1859 1930) ("Dreiser" 1871 1945)
("Dryden" 1631 1700) ("Dumas" 1802 1870)
("Ehrenburg" 1891 1967) ("Eliot" 1819 1880)
("Ellison" 1914 1994) ("Emerson" 1803 1882)
("Farrell" 1904 1979) ("Faulkner" 1897 1962)
("Ferber" 1887 1968) ("Fielding" 1707 1754)
("Fitzgerald" 1896 1940) ("Flaubert" 1821 1880)
("Forester" 1899 1966) ("Forster" 1879 1970)
("France" 1844 1924) ("Frost" 1874 1963)
("Galsworthy" 1867 1933) ("Gardner" 1889 1970)
("Genet" 1911 1986) ("Gibran" 1883 1931)
("Gide" 1869 1951) ("Giraudoux" 1882 1944)
("Goethe" 1749 1832) ("Gogol" 1809 1852)
("Golding" 1911 1993) ("Gorky" 1868 1936)
("Graves" 1895 1985) ("Gray" 1716 1771)
("Greene" 1904 1991) ("Grey" 1872 1939)
("Grimm" 1785 1863) ("Haley" 1921 1992)
("Hammett" 1894 1961) ("Hamsun" 1859 1952)
("Hardy" 1840 1928) ("Harris" 1848 1908)
("Hart" 1904 1961) ("Harte" 1836 1902)
("Hasek" 1883 1932) ("Hawthorne" 1804 1864)
("Heine" 1797 1856) ("Hellman" 1905 1984)
("Hemingway" 1899 1961) ("Henry" 1862 1910)
("Herriot" 1916 1995) ("Hersey" 1914 1993)
("Hesse" 1887 1962) ("Holmes" 1809 1894)
("Housman" 1859 1936) ("Howells" 1837 1920)
("Hughes" 1902 1967) ("Hugo" 1802 1885)
("Hurston" 1903 1960) ("Huxley" 1894 1963)
("Ibsen" 1828 1906) ("Ionesco" 1910 1994)
("Irving" 1783 1859) ("Jackson" 1919 1965)
("James" 1843 1916) ("Jeffers" 1887 1972)
("Johnson" 1709 1784) ("Jonson" 1572 1637)
("Joyce" 1882 1941) ("Kafka" 1883 1924)
("Kaufman" 1889 1961) ("Kazantzakis" 1883 1957)
("Keats" 1795 1821) ("Kilmer" 1886 1918)
("Kipling" 1865 1936) ("Lagerkvist" 1891 1974)
("Lagerlof" 1858 1940) ("Lamartine" 1790 1869)
("Lamb" 1775 1834) ("Lampedusa" 1896 1957)
("Lardner" 1885 1933) ("Lawrence" 1885 1930)
("Lermontov" 1814 1841) ("Lesage" 1668 1747)
("Lessing" 1721 1781) ("Lewis" 1885 1951)
("Lindsay" 1879 1931) ("Lofting" 1886 1947)
("London" 1876 1916) ("Longfellow" 1807 1882)
("Lowell" 1917 1977) ("Machiavelli" 1469 1527)
("Malamud" 1914 1986) ("Mallarme" 1842 1898)
("Malraux" 1901 1976) ("Mandelstam" 1891 1938)
("Mann" 1875 1955) ("Mansfield" 1888 1923)
("Marlowe" 1564 1593) ("Masefield" 1878 1967)
("Masters" 1869 1950) ("Maugham" 1874 1965)
("Maupassant" 1850 1893) ("Mauriac" 1885 1970)
("Mayakovsky" 1893 1930) ("McCarthy" 1912 1989)
("McCullers" 1917 1967) ("Melville" 1819 1891)
("Mencken" 1880 1956) ("Meredith" 1828 1909)
("Merimee" 1803 1870) ("Merrill" 1926 1995)
("Millay" 1892 1950) ("Miller" 1891 1980)
("Milne" 1882 1956) ("Milton" 1608 1674)
("Mishima" 1925 1970) ("Mistral" 1889 1957)
("Mitchell" 1900 1949) ("Moliere" 1622 1673)
("Molnar" 1878 1952) ("Montaigne" 1533 1592)
("Montale" 1896 1981) ("Moore" 1887 1972)
("More" 1478 1535) ("Munro" 1870 1916)
("Musset" 1810 1857) ("Nabokov" 1899 1977)
("Nash" 1902 1971) ("Neruda" 1904 1973)
("Odets" 1906 1963) ("Orwell" 1903 1950)
("Osborne" 1929 1995) ("Paine" 1737 1809)
("Parker" 1893 1967) ("Pasternak" 1890 1960)
("Pepys" 1633 1703) ("Perelman" 1904 1979)
("Petrarca" 1304 1374) ("Pirandello" 1867 1936)
("Plath" 1932 1963) ("Poe" 1809 1849)
("Pope" 1688 1744) ("Porter" 1890 1980)
("Pound" 1885 1972) ("Proust" 1871 1922)
("Pushkin" 1799 1837) ("Rabelais" 1495 1553)
("Racine" 1639 1699) ("Rand" 1905 1982)
("Remarque" 1898 1970) ("Richardson" 1689 1761)
("Rilke" 1875 1926) ("Rimbaud" 1854 1891)
("Robinson" 1869 1935) ("Roethke" 1908 1963)
("Rolland" 1866 1944) ("Ronsard" 1524 1585)
("Rostand" 1868 1918) ("Runyon" 1880 1946)
("Ruskin" 1819 1900) ("Sand" 1804 1876)
("Sandburg" 1878 1967) ("Santayana" 1863 1952)
("Saroyan" 1908 1981) ("Sarton" 1914 1995)
("Sartre" 1905 1980) ("Scarry" 1920 1994)
("Schiller" 1759 1805) ("Scott" 1771 1832)
("Seifert" 1902 1986) ("Seuss" 1904 1991)
("Shakespeare" 1564 1616) ("Shaw" 1856 1950)
("Shelley" 1792 1822) ("Sheridan" 1751 1816)
("Shirer" 1904 1993) ("Sholokhov" 1906 1984)
("Sinclair" 1878 1968) ("Singer" 1904 1991)
("Spender" 1909 1995) ("Spenser" 1552 1599)
("Stead" 1903 1983) ("Steele" 1672 1729)
("Steffens" 1866 1936) ("Stein" 1874 1946)
("Steinbeck" 1902 1968) ("Stendhal" 1783 1842)
("Sterne" 1713 1768) ("Stevens" 1879 1955)
("Stevenson" 1850 1894) ("Stout" 1886 1975)
("Stowe" 1811 1896) ("Strachey" 1880 1932)
("Strindberg" 1849 1912) ("Swift" 1667 1745)
("Swinburne" 1837 1909) ("Synge" 1871 1909)
("Tagore" 1861 1941) ("Tarkington" 1869 1946)
("Taylor" 1917 1994) ("Teasdale" 1884 1933)
("Tenhyson" 1809 1892) ("Thackeray" 1811 1863)
("Thomas" 1914 1953) ("Thoreau" 1817 1862)
("Thurber" 1894 1961) ("Tolkien" 1892 1973)
("Tolstoy" 1828 1910) ("Trollope" 1815 1882)
("Turgenev" 1818 1883) ("Twain" 1835 1910)
("Undset" 1881 1949) ("Valery" 1871 1945)
("Verne" 1828 1905) ("Villon" 1431 1463)
("Waugh" 1903 1966) ("Wells" 1866 1946)
("West" 1893 1983) ("Wharton" 1862 1937)
("White" 1899 1985) ("Whitman" 1819 1892)
("Whittier" 1807 1892) ("Wilde" 1854 1900)
("Wilder" 1897 1975) ("Williams" 1911 1983)
("Wilson" 1895 1972) ("Wodehouse" 1881 1975)
("Wolfe" 1900 1938) ("Woolf" 1882 1941)
("Wordsworth" 1770 1850) ("Wright" 1908 1960)
("Yeats" 1865 1939) ("Zola" 1840 1902)
))
I am indebted to The World almanac and book of facts: 1996 (Mahwah, New Jersey: World Almanac Books, 1995), pp. 357-360, for this collection of data.
The contemporaries procedure should compare its argument
successively to each entry in the database. Whenever it detects a
contemporary, it should select the surname or pseudonym from the database
entry and display it.
Use your contemporaries procedure to find the contemporaries
of
This document is available on the World Wide Web as
http://www.math.grin.edu/courses/Scheme/fall-1997/exercise-2.html
created August 29, 1997
last revised September 1, 1997