First
The first element of a collection.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
First!First(collection)the first element of the collection.First(collection, default)default when the collection is empty, instead of the first element.First(expr)the first operand of any expression, not just a collection.Typed signatures
| Type | Package | Applies |
|---|---|---|
(xs: indexed_collection<any>) -> any | compute-engine | always |
(any, any?) -> any | combinatoricsreplaces compute-engine | always |
Details
- . See At.
- Positional indexing from the front (index 1) and back (negative indices).
- On an empty collection with no default given, returns the symbol rather than raising an error.
- A second argument supplies a default for an empty collection, instead of .
- Works on the operands of any expression, not just a collection's elements.
Examples
4 more kept as data, checked against the oraclesPossible issues #
About
| Examples | 17 |
|---|---|
| Checked against | Wolfram Language 16 agree1 differmathlib4 4 agree1 error |
| Crosswalk | Wolfram Language |
Implementation
mapped
mathlib4packages/oracle/src/mappings.tsThe head of a list; an empty list fails to elaborate (ours is Missing) rather than defaulting, and so does an expression that is not a list.