Skip to content

Instantly share code, notes, and snippets.

@danielribes
Created May 5, 2020 19:33
Show Gist options
  • Save danielribes/ccd58cd86706a35f102268c9bb24c154 to your computer and use it in GitHub Desktop.
Save danielribes/ccd58cd86706a35f102268c9bb24c154 to your computer and use it in GitHub Desktop.
Functional Programming in Erlang The University of Kent - Activity 1.9
%% Functional Programming in Erlang
-module(first).
-export([double/1,mult/2,area/3,treble/1,square/1]).
mult(X,Y) ->
X*Y.
double(X) ->
mult(2,X).
area(A,B,C) ->
S = (A+B+C)/2,
math:sqrt(S*(S-A)*(S-B)*(S-C)).
%%
%% Functional Programming in Erlang
%% Activity 1.9
%%
treble(A) ->
A*3.
square(A) ->
A*A.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment