Created
January 11, 2012 15:49
-
-
Save garrensmith/1595268 to your computer and use it in GitHub Desktop.
Couchdb and erlang course
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}) -> | |
| Side * 4; | |
| perimeter({rectangle,A,B}) -> | |
| (A * 2) + (B * 2); | |
| perimeter({circle,Radius}) -> | |
| Radius * 2 * 3.1415; | |
| perimeter({triangle,A,B,C}) -> | |
| A + B + C. |
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,C}) -> | |
| {f,c2f(C)}; | |
| convert({f,F}) -> | |
| {c,f2c(F)}; | |
| convert({_,_}) -> | |
| io:format("Incorrectly formatted ~n"). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment