7.4

Week 5 Set b

home work!

Programming Language BSL with List Abbreviations

Due Date Thursday 10/3 at 9:00pm (Week 5)

Purpose To get some practice with functions that operate on lists.

Finger Exercises

Exercise 1 From HTDP, 160

Graded Exercises

; An LoN (List of Numbers) is one of:
; - '()
; - (cons Number LoN)

Exercise 2 Design the function interleave, that takes two list of numbers and produces a list of their items, alternating from each list. If the lists have different lengths, just finish with all the remaining items of the longer list.

Exercise 3 Design the function powerlist which returns all possible sublists of a list of numbers. A sublist of a list is any list whose items appear in the same relative order that they do in the initial list and all of the items appear in the initial list. Assume the initial list given to powerlist contains no duplicates.

Exercise 4 Design the function intersection, which given a non-empty list of list of numbers returns the numbers that appear in every sublist. Assume each inner list does not repeat numbers. Note that while the outer list is non-empty, inner lists may be empty.