[racket] missing solution 20.2.2 ex:fancy-contracts

From: Daniel Bastos (dbastos at toledo.com)
Date: Wed Sep 3 09:30:40 EDT 2014

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)

Posted on the users mailing list.