Do any of you know a library for the representation and calculation of cooking units (Cup, Tablespoon, Gallon...) in C# or F# (especially in regard to culture, metric/imperial)?
cup (also c) pint (also p, pt, or fl pt) quart (also q, qt, or fl qt)
The most commonly used prefixes are kilo (k), centi (c), and milli (m). When you read a measurement in the metric system, it is fairly easy to translate the measurement into a number of the basic units. For example, 5 kg (five kilograms) is the same as 5 × 1000 (the meaning of kilo) grams or 5000 grams.
"1 Cup" is equal to 8 fluid ounces in US Standard Volume. It is a measure used in cooking. A Metric Cup is slightly different: it is 250 milliliters (which is about 8.5 fluid ounces).
Units of measure are built into the F# language:
http://msdn.microsoft.com/en-us/library/dd233243.aspx
They can be easily extended with custom units, as long as you know conversion ratios.
Edit: Of course, you might end up with some strange unit types to account between differences in weights and volumes (the ratio of 1 cup of flour to 1 cup of water is not the same as the ratio of 100g of flour to 100g of water...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With