First-class functions
Functions are values like any other - they can be named, passed to other functions, returned and stored - which lets one function hold a pattern of work and take the details from outside.
Depth 1 · Foundation
You can pass a function as a value - a key to sorted, max and min, a lambda, a function to map and filter or to your own function - and you know the difference between len and len().
Sign in to prove what you know with a short quiz, see how deep you've gone, and earn XP for it.
Sign in with GoogleDepths of understanding
- 1
Foundation
You can pass a function as a value - a key to sorted, max and min, a lambda, a function to map and filter or to your own function - and you know the difference between len and len().
- 2
Deeper
You can write a function that makes and returns another function, explain how a closure keeps the names it was made with (and when nonlocal is needed), and write a decorator that wraps any function.
Your path here
What's still between you and First-class functions, depth 1, in the order you can learn it.
- 1ProgramDepth 1 · Foundation · Program Basics
- 2ExpressionDepth 1 · Foundation · Program Basics
- 3Variables in codeDepth 1 · Foundation · Program Basics
- 4Program stateDepth 1 · Foundation · Program Basics
- 5Input and outputDepth 1 · Foundation · Program Basics
- 6Functions in codeDepth 1 · Foundation · Functions
- 7Return valuesDepth 1 · Foundation · Functions
- 8BooleansDepth 1 · Foundation · Control Flow
- 9ConditionalsDepth 1 · Foundation · Control Flow
- 10LoopsDepth 1 · Foundation · Control Flow
- 11Accumulator patternDepth 1 · Foundation · Control Flow
- 12Floating-point numbersDepth 1 · Foundation · Data Types
- 13Basic typesDepth 1 · Foundation · Data Types
- 14Character encodingDepth 1 · Foundation · Data Types
- 15StringsDepth 1 · Foundation · Data Types
- 16ListsDepth 1 · Foundation · Data Structures
- 17First-class functionsDepth 1 · Foundation · Functions
Where it fits
This concept