Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

bbbbbHomework 1

Due: 11:59pm, Tuesday, Sep 08, 2020

...

  • Do the following programming problems:
    1. [10 pts] Develop the function contains? that consumes a symbol and a list of symbols and determines whether or not the symbol occurs in the list.
    2. [10 ptsDevelop the function howcount-many-symbols that consumes a list of symbols and produces the number of items in the list.
    3. [10 ptsDevelop the function how-manycount-numbers that counts how many numbers are in a list of numbers. 
    4. [20 ptsDevelop the function averageavg-price. It consumes a list of toy prices and computes the average price of a toy. The average is the total of all prices divided by the number of toys. toy prices are numbers. [Hint: develop several auxiliary functions (following the design recipe to develop each auxiliary function) that you can use to make the definition of average-price very easy.
    5. [10pts] Develop the function eliminateelim-exp to eliminate expensive toys. The function consumes a number, called mp (short for "maximum price) and a list of toy prices, called lotp, and produces a list of all those prices in lotp that are below or equal to mp. For example
      (check-expect (eliminateelim-exp 1.0 (list 2.95 .95 1.0 5) (list .95 1.0)) = #true

       

    6. [10pts] Develop the function delete to eliminate specific toys from a list. The function consumes the name of a toy, called ty, and a list of names, called lon, and produces a list of names that contains all components of lon with the exception of ty. For example,

      (check-expect (delete 'robot (list 'robot 'doll 'dress empty)) (list 'doll 'dress)) los

       

    7. [20pts] A list can be used to represent a finite set. For example,  

      (list 'c 'o 'm 'p)

      represents the set of symbols {'c , 'o, 'm, 'p}.  In such a representation, we assume all elements in the list are unequal.   Develop the function power that consumes a list of symbols symbols los (representing a set) and produces a list of list of symbols representing the power set (set of all subsets) of of los.  

       

    8. Be sure to do all the assigned parts of each problem. In the book, each problem ends with a block icon. Online, each problem ends with a hand icon.

...