CS 268: Lecture 15 – Higher-order Functions

Dear students:

Today we hit up higher-order functions, a feature of modern languages that will shorten up your code considerably. Once you know a few of these higher-order functions, you may never write loops again. Why? Because so much of our looping algorithms follow certain patterns, we can generalize those patterns into reusable functions. For the parts of the algorithms that differ, we take in functions from the callers are parameters.

We’ll be using these higher-order functions frequently when we build React apps, starting next week.

Here’s your TODO list:

  • Watch this video, in which we discuss the map function pattern.
  • Watch this video, in which we discuss the filter function pattern.
  • Watch this video, in which we discuss the reduce function pattern.
  • You are encouraged to post a reply in the lecture 15 thread with one of the following:
    • A question regarding map, filter, reduce, or higher-order functions in general. This might be a question you really don’t know the answer to or one that you do know the answer to and are putting forward as a challenge to your peers.
    • An answer to a previously posted question or challenge.
    Your participation in this thread is not graded. I include it so that we can maintain some real human interaction.

See you next time.



Leave a Reply

Your email address will not be published. Required fields are marked *