2.2. Tasks for Assessment of BSCS.OC11 in CS 152 at the Intermediate level

 

Students who pass CS 152 should be able to perform two or more of the following tasks in a functional language such as Haskell or Scheme.

Task 1:

Implement a function that uses list recursion, for example, a function that uses list recursion to filter all even numbers out of a list of numbers.

   > filterEvens [1 2 3 4 5 6 7]

   [1 3 5 7]

Task 2:

Implement a function that uses tail recursion, for example, a function that uses tail recursion to filter all even numbers out of a list of numbers.

Task 3:

Implement a function with function parameters, for example, a function that filters all numbers out of a list of numbers that pass some test specified by a parameter.

   > filter even? [1 2 3 4 5 6 7]

   [1 3 5 7]

Task 4:

Implement a function that returns a function as a value, for example, a function that takes a function f as a parameter and returns a function approximating f's derivative.

   > f x = x * x

   ok

   > df = deriv f

   ok

   > df 10

   20

Task 5:

Students should be able to trace the execution of functions involving one of the following operations:

  1. Recursion
  2. Thunks (promises)
  3. Closures
  4. Statically bound variables
  5. Filter
  6. Map
  7. Fold