liveBook · Manning

Identity function

As explained in Fabulous Adventures in Data Structures and Algorithms

An identity function returns its argument unchanged.

An identity function returns its argument unchanged. In a Hughes list, it represents the empty list: concatenating an empty list onto any stack leaves that stack unchanged. section 2.7.3

Identity as empty storage

A partially applied function can capture a value and later reveal it: storage(0) returns 123. The Hughes-list equivalent is Empty = Make(stack => stack), which returns its supplied stack unchanged. section 2.7.3

How Fabulous Adventures in Data Structures and Algorithms covers it

How deep it goes
Defines the function algebraically and implements it as a C# delegate, including reference-identity handling.
Examples
Demonstrates captured integer storage and an empty Hughes list implemented by a delegate returning its stack argument.
What it assumes
Assumes familiarity with functions, delegates, partial application, and immutable stacks.
What you can do after
Apply it via C# delegates to model empty Hughes lists and compose stack-preserving concatenations.
How it connects
Connects identity functions with Hughes lists, partial application, delegates, concatenation, and immutable stacks.

Also explained in

Compare how 3 books explain identity function →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fabulous Adventures in Data Structures and Algorithms. The section links point to the parts of the book it draws on.