Created
January 18, 2012 03:27
-
-
Save pfiled/1630674 to your computer and use it in GitHub Desktop.
week 1 erlang
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(mathStuff). | |
-export([perimeter/1]). | |
perimeter({square,Side}) -> | |
4 * Side; | |
perimeter({circle,Radius}) -> | |
2 * 3.1415926 * Radius; | |
perimeter({triangle,A,B,C}) -> | |
A + B + C; | |
perimeter({polygon,L}) -> | |
lists:sum(L). |
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(temp). | |
-export([f2c/1, c2f/1, convert/1]). | |
f2c(F) -> | |
(F - 32) * 5 div 9. | |
c2f(C) -> | |
C * 9 div 5 + 32. | |
convert({c,T}) -> | |
c2f(T); | |
convert({f,T}) -> | |
f2c(T). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment