Tail
A tail is the remaining or terminal part of a structured sequence or the endpoint of a linked relation.
Grokking Data Structures
The tail is the reference or position identifying the last node of a linked list.
- How it is used
- Uses the tail to identify and efficiently update the end of linked lists.
- How deep it goes
- Explains tail semantics, constant-time end insertion, backward traversal, and deletion updates, but does not formalize implementation invariants.
- Examples
- Shows Python append and deletion implementations that assign, advance, or clear the tail.
- What you can do after
- Build it from scratch by maintaining tail references during linked-list insertion and deletion.
Functional Programming in Scala, Second Edition
tail is a list operation that returns all elements except the first, failing when applied to Nil.
- How it is used
- Uses persistent list structure to remove the first element without mutation or copying.
- How deep it goes
- Explains constant-time removal and the Nil failure case, but defers alternative error-handling techniques.
- Examples
- Uses Cons(x, xs), mylist, and the shared structure illustrated by Figure 3.3.
- What you can do after
- Build it from scratch as a constant-time operation over the custom Scala List type.
Read how Functional Programming in Scala, Second Edition explains tail →
Elixir in Action, Third Edition
The tail of a list is the remainder following its first element in a head-and-tail representation.
- How it is used
- Uses the tail to expose list structure for traversal and decomposition.
- How deep it goes
- Explains recursive structure and extraction with tl/1, but defers recursive algorithms and detailed complexity analysis.
- Examples
- Demonstrates [1, 2, 3, 4], [head | tail], and tl([1, 2, 3, 4]).
- What you can do after
- Apply tl/1 to obtain the remainder of a nonempty list and recognize its head-and-tail form.
Related concepts
- referenceconfigured by · A reference is an indirect value or relationship that identifies or provides access to another value, object, resource, or source.
- listimplements · A list is an ordered collection of elements arranged in a sequence.
- tuplepart of · A tuple is a finite, ordered collection of elements treated as a single composite value or record.
- linked listpart of · A linked list is an ordered sequence of nodes connected by links or references rather than stored as one contiguous sequence.
- doubly linked listused by · A doubly linked list is a linked sequence in which each node has references to both its predecessor and successor.
- pattern matchingproduced by · Pattern matching is the process of comparing values, structures, or other data with specified or learned patterns to determine correspondence, often enabling classification, extraction, or selection of behavior.
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.


