Andrey (azangru) wrote,
Andrey
azangru

Via HN, a beautiful illustration of the difference between imperative and functional programming style, pastiched through an example of a cake recipe:

Imperative:
1. Preheat oven to 175 degrees C. Grease and flour 2 – 8 inch round pans. In a small bowl, whisk together flour, baking soda and salt; set aside.
2. In a large bowl, cream butter, white sugar and brown sugar until light and fluffy. Beat in eggs, one at a time. Mix in the bananas. Add flour mixture alternately with the buttermilk to the creamed mixture. Stir in chopped walnuts. Pour batter into the prepared pans.
3. Bake in the preheated oven for 30 minutes. Remove from oven, and place on a damp tea towel to cool.

Functional:
1. A cake is a hot cake that has been cooled on a damp tea towel, where a hot cake is a prepared cake that has been baked in a preheated oven for 30 minutes.
2. A preheated oven is an oven that has been heated to 175 degrees C.
3, A prepared cake is batter that has been poured into prepared pans, where batter is mixture that has chopped walnuts stirred in. Where mixture is butter, white sugar and brown sugar that has been creamed in a large bowl until light and fluffy…


(source)

Also via HN, an impressively long and outrageously funny commit message in mpv-player.
Subscribe

  • (no subject)

    A hilarious piece of web comedy in the style of Monty Python. Can only be viewed on the author's web page, because privacy settings. But so worth it.…

  • (no subject)

    A very impressive demo of real-time noise suppression software for Linux called NoiseTorch: - audio demo on the Linux for Everyone podcast…

  • (no subject)

    Twitter is having fun:

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments