The programming language Chef, devised by David Morgan-Mar, is designed to make programs look like cooking recipes. Variables are represented by “ingredients,” input comes from the “refrigerator,” output is sent to “baking dishes,” and so on. The language’s design principles state that “program recipes should not only generate valid output, but be easy to prepare and delicious,” but many of them fall short of that goal — one program for soufflé correctly prints the words “Hello world!”, but the recipe requires 32 zucchinis, 101 eggs, and 111 cups of oil to be combined in a bowl and served to a single person. Mike Worth set out to write a working program that could also be read as an actual recipe. Here’s what he came up with:
Hello World Cake with Chocolate sauce. This prints hello world, while being tastier than Hello World Souffle. The main chef makes a " world!" cake, which he puts in the baking dish. When he gets the sous chef to make the "Hello" chocolate sauce, it gets put into the baking dish and then the whole thing is printed when he refrigerates the sauce. When actually cooking, I'm interpreting the chocolate sauce baking dish to be separate from the cake one and Liquify to mean either melt or blend depending on context. Ingredients. 33 g chocolate chips 100 g butter 54 ml double cream 2 pinches baking powder 114 g sugar 111 ml beaten eggs 119 g flour 32 g cocoa powder 0 g cake mixture Cooking time: 25 minutes. Pre-heat oven to 180 degrees Celsius. Method. Put chocolate chips into the mixing bowl. Put butter into the mixing bowl. Put sugar into the mixing bowl. Put beaten eggs into the mixing bowl. Put flour into the mixing bowl. Put baking powder into the mixing bowl. Put cocoa powder into the mixing bowl. Stir the mixing bowl for 1 minute. Combine double cream into the mixing bowl. Stir the mixing bowl for 4 minutes. Liquify the contents of the mixing bowl. Pour contents of the mixing bowl into the baking dish. bake the cake mixture. Wait until baked. Serve with chocolate sauce. chocolate sauce. Ingredients. 111 g sugar 108 ml hot water 108 ml heated double cream 101 g dark chocolate 72 g milk chocolate Method. Clean the mixing bowl. Put sugar into the mixing bowl. Put hot water into the mixing bowl. Put heated double cream into the mixing bowl. dissolve the sugar. agitate the sugar until dissolved. Liquify the dark chocolate. Put dark chocolate into the mixing bowl. Liquify the milk chocolate. Put milk chocolate into the mixing bowl. Liquify contents of the mixing bowl. Pour contents of the mixing bowl into the baking dish. Refrigerate for 1 hour.
Worth confirmed that this correctly prints the words “Hello world!”, and then he used the same instructions to bake a real cake. “It was surprisingly well received,” he writes. “The cake was slightly dry (although nowhere near as dry as cheap supermarket cakes), but this was complimented well by the sauce. My brother even asked me for the recipe!”
While we’re at it: Fibonacci Numbers With Caramel Sauce.