>

CS 1323 Honors, Fall 1996

Individual Project 1
Due Thursday, August 29

Using Canned Software to Arrange Names in Alphabetical Order


import SequenceUtilities
names =
  unlines[
    "John Peterson",
    "Kevin Hammond",
    "Alastair Reid",
    "Mark Jones",
    "Paul Hudak",
    "Brian Boutel",
    "Andrew Gordon",
    "John Hughes",
    "Simon PeytonJones",
    "Philip Wadler",
    "Thomas Johansson",
    "Lennart Augustsson",
    "Warren Burton",
    "Joseph Fasel"]
swapNames = unwords . reverse . words
swapAllNamesInSequence names = [swapNames name | name <- names]
namesAlphabetical =
  (unlines . swapAllNamesInSequence . quicksort .
                       swapAllNamesInSequence . lines) names