Last active
August 29, 2015 13:59
-
-
Save bjartwolf/10506546 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
[<Measure>] type Length | |
[<Measure>] type Area = Length*Length | |
let area (a : float<Length>) (b: float<Length>) = 2.0*a*b | |
let a1:float<Area> = area 0.0<Length> 1.0<Length> | |
let a2:float<Area> = area 1.0<Length> 0.0<Length> | |
let a3:float<Area> = area 1.0<Length> 1.0<Length> | |
("for 0,1: " + a1.ToString()).Dump() | |
("for 1,0: " + a2.ToString()).Dump() | |
("for 1,1, circle should be pi: " + a3.ToString()).Dump() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for 0,1: 0
for 1,0: 0
for 1,1, circle should be pi: 2