CSci 555: Functional Programming
Fall Semester 1998

Assignment #3
Due Wednesday, 14 October, 1998


  1. Define functions to give the sum of the squares of the negative values in a list of integers (type Int).
    1. Give a backward recursive definition.
    2. Give a definition that uses a tail recursive auxiliary function.
    3. Give a definition that uses standard prelude functions such as map, filter, foldr, and foldl.
    4. Give a definition that uses a list comprehension.

  2. Define a function total
        total :: (Int -> Int) -> (Int -> Int)
    
    so that total f n gives
        f 0 + f 1 + f 2 + ... + f n
    

  3. Define a function
        filterFirst :: (a -> Bool) -> [a] -> [a}
    
    so that filterFirst p xs removes the first element of xs that does not have the property p.

  4. Do exercise #3 on page 75 of the Notes.

  5. Do exercise #4 on page 75 of the Notes.

Please format and document your program source code appropriately. (All of the above functions should be defined in the same file.)

Test your programs appropriately and thoroughly.

When this assignment is complete, submit a paper listing of your program source code and the screen outputs from executing the program. Be sure that all items submitted are clearly labeled with your name and the assignment number. Include the Honor Code statement as described in the Assignments section of the Syllabus.

Also submit your program source code using EASE, the Electronic Assignment Submission Environment, at URL http://www.cs.olemiss.edu/submit/. Your username for that system is your sunset account name.


UP to CSCI 555 assignments document?


Copyright © 1999, H. Conrad Cunningham
Last modified: Wed May 12 11:07:45 CDT