Skip to content

Instantly share code, notes, and snippets.

@bjartwolf
Last active August 29, 2015 13:59
Show Gist options
  • Save bjartwolf/10506546 to your computer and use it in GitHub Desktop.
Save bjartwolf/10506546 to your computer and use it in GitHub Desktop.
[<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()
@bjartwolf
Copy link
Author

for 0,1: 0
for 1,0: 0
for 1,1, circle should be pi: 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment