Skip to content

Latest commit

 

History

History

chapter_4

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Exercises for Chapter 4

1. Extend geometry.erl. Add clauses for the area of circles and right-angle triangles. Add clauses for computing the perimeter of shapes.

Solution in the exercise_1 directory.

2. Create your own implementation of tuple_to_list/1 that doesn't use the BIF.

Solution in the exercise_2 directory.

3. Write a function that times execution of a function. Write a function that formats the time of day.

Solution in the exercise_3 directory.

4. Implement any of the functions from Python's datetime class that are not in Erlang's erlang module.

Solution in the exercise_4 directory.

5. Write a module with two functions - even/1 and odd/1. They should return true or false based on whether the number is even or not.

Solution in the exercise_5 directory.

6. Implement the higher order function filter/2. The function should take a function that returns a boolean and a list.

Solution in the exercise_6 directory.

7. Write a function that uses the function from exercise #6 to split a list of numbers into two lists containing even and odd numbers.

Solution in the exercise_7 directory.