Averages/Arithmetic mean: Difference between revisions
Content added Content deleted
(Renamed variables) |
Underscore (talk | contribs) (→{{header|Chef}}: Replaced with a version that accepts any number of inputs.) |
||
Line 219: | Line 219: | ||
=={{header|Chef}}== |
=={{header|Chef}}== |
||
{{in progress|lang=Chef|day=02|month=12|year=2009}} |
|||
{{untested}} |
|||
<lang Chef>Mean. |
<lang Chef>Mean. |
||
Chef has no way to detect EOF, so rather than interpreting |
|||
Only reads single values. |
|||
some arbitrary number as meaning "end of input", this program |
|||
expects the first input to be the sample size. Pass in the samples |
|||
themselves as the other inputs. For example, if you wanted to |
|||
compute the mean of 10, 100, 47, you could pass in 3, 10, 100, and |
|||
47. To test the "zero-length vector" case, you need to pass in 0. |
|||
Ingredients. |
Ingredients. |
||
0 g Sample Size |
|||
1 cup Vodka |
|||
0 g Counter |
|||
2 tablespoons Kummel® Caraway Liqueur |
|||
0 g Current Sample |
|||
3 teaspoons Lime Juice |
|||
Method. |
Method. |
||
Take |
Take Sample Size from refrigerator. |
||
Put |
Put Sample Size into mixing bowl. |
||
Fold Counter into mixing bowl. |
|||
Take Lime Juice from refridgerator. |
|||
Put Current Sample into mixing bowl. |
|||
Loop Counter. |
|||
⚫ | |||
Take Current Sample from refrigerator. |
|||
⚫ | |||
Add Current Sample into mixing bowl. |
|||
Endloop Counter until looped. |
|||
If Sample Size. |
|||
⚫ | |||
Put Counter into 2nd mixing bowl. |
|||
Fold Sample Size into 2nd mixing bowl. |
|||
Endloop until ifed. |
|||
⚫ | |||
Serves 1.</lang> |
Serves 1.</lang> |