12
\$\begingroup\$

Your challenge is to write a Chef program that works well as a recipe and also as a program. Its utility as a recipe is strictly required (I don't want a recipe for grapeleaves in chocolate-mustard sauce); its utility as a program is a looser requirement, so that it is enough to print something interesting (the first few integers, for example, or "just another chef", or "just another Chef hacker", or "hello world") or do some helpful calculation (printing the sum of two numbers, for example). Votes should take this into account, and the winner is the program with the most net upvotes after some time.

(Code length is not important here.)

\$\endgroup\$
1
  • 2
    \$\begingroup\$ I'm not sure it's worth having a tag for it. Tags are to categorise related questions, and it doesn't seem too likely that we'll have more than one question about Chef. \$\endgroup\$ Commented Jan 15, 2012 at 23:01

1 Answer 1

6
\$\begingroup\$

I wrote this program for another challenge, but I decided to try and make it a valid answer for this one too:

Shirred Eggs.

This recipe prints the number 2 and, in doing so, yields two delicious
shirred eggs.

Ingredients.
2 eggs

Cooking time: 12 minutes.

Pre-heat oven to 175 degrees Celsius.

Method.
Put eggs into mixing bowl. Pour contents of the mixing bowl into the
baking dish. Shirr the eggs. Bake the eggs until shirred.

Serves 1.

As I mentioned in the other answer, it seems pretty hard to write anything in Chef that involves something more complicated than mixing stuff in a bowl and baking it, and still have it work both as a program and as a recipe.

Edit: Changed the recipe from fried to shirred eggs — thanks to Blazer for the suggestion! The cooking time and temperature should be considered advisory only; I haven't actually tried the recipe yet myself, so I can't vouch for their accuracy.

\$\endgroup\$
3
  • \$\begingroup\$ Waitaminute: as is, this outputs 1, not 2. ("Fry the eggs until baked" decrements eggs.) No? \$\endgroup\$
    – msh210
    Commented Feb 6, 2012 at 19:05
  • \$\begingroup\$ I tested this using the Acme::Chef interpreter, and it outputs 2. The last two sentences in the "Method" section don't actually affect the output at all (since it's already been moved to the baking dish), they're just there to tell you not to eat the eggs raw. \$\endgroup\$ Commented Feb 6, 2012 at 19:16
  • \$\begingroup\$ Ah, of course: quite right. \$\endgroup\$
    – msh210
    Commented Feb 6, 2012 at 19:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.