liveBook · Manning

First-class function

A first-class function is a function that can be treated as a value, such as being assigned, stored, passed as an argument, or returned.

How 2 Manning books explain it

Functional Programming in C#, Second Edition

A programming-language feature that allows functions to be treated like values, including being assigned, stored, and passed as arguments or returned.

How it is used
Uses first-class functions as a foundation for functional programming and passing behavior to other functions.
How deep it goes
Defines value-like operations and demonstrates C# delegates and lambdas, while deferring detailed type-inference limitations.
Examples
Shows a tripling function passed to LINQ Select and a comparison delegate passed to Sort.
What you can do after
Apply it via C# delegates and LINQ to pass operations into methods.

Read how Functional Programming in C#, Second Edition explains first-class function →

Secrets of the JavaScript Ninja, Third Edition

A function that can be treated as a value, including being assigned, passed as an argument, or returned.

How it is used
Enables callbacks for event handling and custom sorting by letting other code receive and invoke functions.
How deep it goes
Defines object-like function capabilities and traces a callback invocation, but defers a fuller treatment of functional programming.
Examples
Uses a passed text-returning callback, an inline callback, a mousemove handler, and an array-sort comparator.
What you can do after
Practice/perform storing functions and passing callbacks to JavaScript code that invokes them later.

Read how Secrets of the JavaScript Ninja, Third Edition explains first-class function →

What to know first

Related concepts

Questions about first-class function

What is first-class function?

A first-class function is a function that can be treated as a value, such as being assigned, stored, passed as an argument, or returned.

Which Manning books explain first-class function?

Functional Programming in C#, Second Edition and Secrets of the JavaScript Ninja, Third Edition.

What should I know before learning first-class function?

Manning books that teach first-class function usually introduce array first.

What kinds of first-class function are there?

Kinds of first-class function include function.

What is first-class function a kind of?

First-class function is a kind of object. An object is a distinct entity represented or manipulated within a computational system, typically as a value, data structure, resource, or instance of a type.

What is first-class function part of?

First-class function is part of functional programming. Functional programming is a programming paradigm that expresses computation through the evaluation and composition of functions, typically favoring immutable data and minimizing mutable state and side effects.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.