To play this document inside your browser use ALT-N and ALT-P.
You can
save your edits
inside your browser and
load them back
(edits are also saved when you close the window). Finally you can
download
the file for offline editing.
Exercise :
- Define the option container with constructors None and Some
- Define the
projection
default
Exercise :
Define boolean negation
Exercise :
Use the
iter function below to define:
- addition over natural numbers.
- multiplication over natural unmbers.
Exercise :
- Use the the existing map function to define a functions that adds 2 to
all elements of a list of integers.
- Use the result of the previous exercise and the iter function to define
a function that maps the natural number n to the list containing the n first
odd numbers. (start with the empty list and then at each step, add 1 in front
and increase all other elements by 2).