The part of a list or sequence that follows the head is called the tail.
Imagine you're lining up for ice cream. The person at the front of the line, the first person, is like the head of the line. But everyone else behind them, waiting to get their treat, makes up the tail of the line.
So if we think of a list as an ice cream line:
- The head is the first person.
- The tail is everyone else in the line after that.
Just like you can take the first person out of the line (the head), you can also look at or work with the rest of the people, the tail. It's like saying, "Okay, now who’s next?" and then looking at all the other kids still waiting.
If we write this idea in a simple way:
- A list is like an ice cream line.
- The head is the first person.
- The tail is everyone else after that, they’re still waiting for their turn.
Examples
- In a list like [1, 2, 3], the head is 1 and the tail is [2, 3].
- The tail of your favorite song playlist is what plays after the first track.
Ask a question
See also
- What are arithmetic progressions?
- Why Do Prime Numbers Hide in the Fibonacci Sequence?
- What are progressions?
- What is 12 34 56 78 9?
- What are time-based dependencies?