I am fairly new to functional paradigm so here is my question
I have a function that calculates the perimeter of a circle and a rectangle which works, here it is
perim({circle, {X,Y}, R}) ->
math:pi()*(R * 2);
perim({rectangle, {X,Y}, H, W})->
(H + W) * 2.
Now my question is how to define a function to test whether or not two shapes overlap. Having said that they can be 2 circles overlapping or 2 rectangles or a circle and a rectangle. The only hint i got from Erlang documentation is to use abs() function.
Any help greatly appreciated