A candidate for a solution.

Exercise 20.2.2. Formulate contracts for the following functions:

1. sort, which consumes a list of numbers and a function that consumes
two numbers (from the list) and produces a boolean; sort produces a
list of numbers.

2. map, which consumes a function from numbers to numbers and a list
of numbers; it also produces a list of numbers.

3. project, which consumes a list of lists of symbols and a function
from lists of symbols to symbols; it produces a list of symbols.

Solution.

sort: (listof number) (number number -> boolean) -> (listof number)

map: (number -> number) (listof number) -> (listof number)

project: (listof (listof symbol)) ((listof symbol) -> symbol) -> (listof symbol)
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to