Chef (programming language)

From Wikipedia, the free encyclopedia

Chef is an esoteric programming language designed by David Morgan-Mar. It is based on the manipulation of data values in a number of stacks. Each program consists at minimum of the following:

  • A title
  • A list of variables and their data values
  • A list of instructions for stack manipulation

The joke is that the variables tend to be named after basic foodstuffs, the stacks are called 'mixing bowls' and the instructions for manipulating them 'mix', 'stir', etc.. A program, then, reads much like a cooking recipe.

A Hello World example program in Chef:

 Hello World Souffle.
 
 Ingredients.
 72 g haricot beans
 101 eggs
 108 g lard
 111 cups oil
 32 zucchinis
 119 ml water
 114 g red salmon
 100 g dijon mustard
 33 potatoes
 
 Method.
 Put potatoes into the mixing bowl.
 Put dijon mustard into the mixing bowl.
 Put lard into the mixing bowl.
 Put red salmon into the mixing bowl.
 Put oil into the mixing bowl.
 Put water into the mixing bowl.
 Put zucchinis into the mixing bowl.
 Put oil into the mixing bowl.
 Put lard into the mixing bowl.
 Put lard into the mixing bowl.
 Put eggs into the mixing bowl.
 Put haricot beans into the mixing bowl.
 Liquefy contents of the mixing bowl.
 Pour contents of the mixing bowl into the baking dish.
 
 Serves 1.

The phrase "Hello world" is encoded as ASCII values in the amount specifiers in the recipe. The ingredient names themselves are variable names, and are here named with a starting letter matching the letter encoded in the number in front for convenience. Notice the first letter of each word forms the phrase "hellozworldp" when read in reverse order.

potatoes 
dijon mustard
lard
red
oil
water
zucchinis
oil
lard
lard
eggs
haricot beans

The order of the words is reversed because when the phrase "hello world" is printed out, the ingredients are "popped" from the stack (also known as the mixing bowl). The last element (last ingredient) to be put in the stack is the first element out of the stack.

A Fibonacci example program can be found on the language's website.

[edit] External links

In other languages