Chapter 6. Composing functions

This chapter covers

  • Using functions for program clarity
  • The problem with state
  • Using functions to create abstractions
  • Techniques for combining functions

In contrast to what you learned about objects, you needn’t learn any more features to compose programs with functions. Instead, you must learn how to create your own features by putting together functions using the basic function glue that you learned in chapter 3. This principle applies to trivial examples such as defining an average function in terms of sum and divide functions and to nontrivial examples that you’ll see in this chapter. To compose programs with functions, you must learn principles and techniques, not features.

Functions have inputs (arguments) ...

Get CoffeeScript in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.