Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cooking Measurements in C# / F#

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)?

like image 245
Amenti Avatar asked Jun 28 '11 08:06

Amenti


People also ask

What is C in cooking recipes?

cup (also c) pint (also p, pt, or fl pt) quart (also q, qt, or fl qt)

What unit is C in food?

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.

What is the measurement of 1 C?

"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).


1 Answers

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...)

like image 112
mavnn Avatar answered Sep 22 '22 15:09

mavnn