First commit
This commit is contained in:
commit
1dba0af064
36 changed files with 1065 additions and 0 deletions
12
circle.ex
Normal file
12
circle.ex
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
defmodule Circle do
|
||||
@moduledoc "Implements basic circle functions"
|
||||
@pi 3.14159
|
||||
|
||||
@doc "Computes the area of a circle"
|
||||
@spec area(number) :: number
|
||||
def area(r), do: r * r * @pi
|
||||
|
||||
@doc "Computes the circumferenc of a circle"
|
||||
@spec circumference(number) :: number
|
||||
def circumference(r), do: 2 * r * @pi
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue