Knaph

Functions

Map

Arrows point from what you learn first to what it opens. Point at a concept to light up its chain and where it comes back deeper. Right-click a concept (or press and hold it) for its lessons and stories.

  • Proven to depth123
  • Open
  • Locked
  • Comes back deeper
Depth 2Depth 2DecompositionFirst-class functionsFunctions in codeRecursionReturn valuesScopeConditionalsIn Control FlowNested dataIn Data StructuresInput and outputIn Program BasicsListsIn Data Structures

Learning path

In the order the concepts build on each other.

  1. Functions in codeLockedNamed, reusable blocks of code that take inputs (parameters) and produce outputs (return values).Opens after: Input and output
  2. First-class functionsLockedFunctions 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.Opens after: Lists, Functions in code
  3. RecursionLockedA function that solves a problem by calling itself on a smaller version of the same problem, until it reaches a base case.Opens after: Functions in code, Conditionals, Nested data
  4. Return valuesLockedThe value a function hands back to the code that called it, with return, so its answer can be stored, added or passed on - unlike print, which only shows it on the screen.Opens after: Functions in code
  5. ScopeLockedWhere in a program a name can be used - names made inside a function are local to it, so functions can't trip over each other's names.Opens after: Return values
  6. DecompositionLockedSplitting a task into smaller named steps, each small enough to write and check on its own, so a big program reads as a story of calls.Opens after: Scope

Connections to other domains