CSci 5511 - Homework 1

Homework 1 -- due Wednesday January 28

This homework will be graded out of 40 points. It will count 4% of the grade.
Turn in the answer to question 1 on paper and the answers to question 2 electronically using the IT Labs Submit Tool.
  1. [20 points] Select and read a paper from The Singularity Issue of IEEE Spectrum. The papers are all short and written for a general public. Write approximatively a page of comments about the paper you have read, specifying what the paper is about, what do you think are its strengths and its weaknesses, and why you have chosen it.

  2. [20 points] Answer the following Lisp questions.
    To answer them you need:

    1. [5 points] Write a function (incr1 lst) that adds 1 to each element of a list of numbers. It should work like this:
        (incr1 '(5 10 17)) = (6 11 18)
        (incr1 '(-5 7)) = (-4 8)
        (incr1 '()) = NIL
      [5 points] Write a function (add2even n lst) that adds a given number n to each even number in a list of numbers. You can use the system defined predicate (evenp n) to check if a number is even. It should work like this:
       
        (add2even 2 '(5 10 17)) = (5 12 17)
        (add2even 3 '(10 0 -17)) = (13 3 -17)
        (add2even 3 '()) = NIL 
    2. [5 points] Write a function (enumerate n) that returns a list containing the integers from n to 0 (extremes included). Assume that n is positive. It should work like this:
        (enumerate 3)  = (3 2 1 0)
        (enumerate 0)  = (0)
    3. [5 points] Write a procedure (add-square-odd n) that adds the square of the odd integers from 0 to n. Assume n is a positive integer. It should work like this:
        (add-square-odd 6) = 35   ; since 1+(3*3)+(5*5)=35
        (add-square-odd 5) = 35   ; since 1+(3*3)+(5*5)=35
        (add-square-odd 3) = 10   ; since 1+(3*3)=10
        
Copyright: © 2009 by the Regents of the University of Minnesota
Department of Computer Science and Engineering. All rights reserved.
Comments to: Maria Gini
Changes and corrections are in red.