Skip to content

Instantly share code, notes, and snippets.

@usagi
Created August 25, 2009 18:41
Show Gist options
  • Save usagi/174915 to your computer and use it in GitHub Desktop.
Save usagi/174915 to your computer and use it in GitHub Desktop.
// Question: What's dimention(units of measure) of E in F# calculate.
// Generally, human brain will answer "<J>", but...
[<Measure>] type m
[<Measure>] type s
[<Measure>] type kg
[<Measure>] type N = kg m / s^2
[<Measure>] type J = N m
let E m g h = m * g * h
let m = 65.<kg>
let g = 9.8<m/s^2>
let h = 4.<m>
printfn "E = %O" (E m g h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment