|
|
|
|
|
by lou1306
1641 days ago
|
|
Don't forget F#'s units of measure! Which by the way are pretty cool, as the compiler automatically infers new units of measure for you: > [<Measure>] type km;
> [<Measure>] type hour;
> let distance = 60.0<km>;
> let time = 0.5<hour>;
> let avgSpeed = distance / time ;;
val avgSpeed : float<km/hour> = 100.0
(And of course forbids physically illegal stuff such as adding values with different dimensions) |
|