Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 749 Bytes

README.md

File metadata and controls

24 lines (19 loc) · 749 Bytes

Parrot trouble

In the apartment next to yours there is an annoying talking parrot. The regulations of your flat prohibit making noise before 7am and after 8pm.

Define a function with type:

parrot_trouble : bool -> int -> bool option

where the first parameter tells whether the parrot is talking or not, while the second parameter represents the current time (from 0 to 23).

The function returns Some true whenever the parrot is talking at a time prohibited by the regulations. The special value None must be used when the input time is outside the range 0..23.

Before starting the exercise, experiment with utop or TryOCaml to learn how to use the option type:

None;;
Some 3;;
Some (2+2);;