Created
May 4, 2020 07:28
-
-
Save sushant12/0181de4c13a8563f99050bd65a7cdcb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(first). | |
-export([double/1,mult/2,area/3,square/1,trebel/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)). | |
square(Num) -> | |
mult(Num, Num). | |
trebel(Num) -> | |
mult(3,Num). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(second). | |
-import('first', [square/1, mult/2]). | |
-export([area/2, hypotenuse/2, perimeter/2]). | |
hypotenuse(A, B) -> | |
math:sqrt(square(A) + square(B)). | |
area(A,B) -> | |
mult(A,B) / 2. | |
perimeter(A,B) -> | |
A + B + hypotenuse(A, B). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wow! @elbrujohalcon and @sushant12, thank you for leaving these comments. I'm here to find how to use import from one module to another one. But now it really sounds more logic and clean to use
filename:module()
syntax instead of-import('blah', [blah/1])
.Nice :)