Arrays need operations to be worth having. Today you add a family of built-ins - first, last, rest, and push - all following the same pattern and all producing new arrays rather than mutating.
Add the first, last, rest, and push built-ins, each returning a new value without mutating its input.
With indexing in place, a handful of built-ins make arrays genuinely useful,
and they all follow the builtin pattern you set up for len: validate the
argument is an array, then compute. first and last return the end elements (or
null when empty), rest returns everything after the first, and push returns
the array with one element added.
The important design rule is immutability: rest and push build and return
new arrays rather than changing their input, so push([1,2], 3) gives
[1,2,3] while the original [1,2] is untouched. That keeps values predictable
and is exactly what lets you write recursive list algorithms - like the map you
will build in the final lesson - without one call clobbering another’s data.
// add to the builtins registry, each validating it got an *Array:// first -> element 0 (or NULL if empty)// last -> last element (or NULL if empty)// rest -> a NEW array of all but the first element// push -> a NEW array with one element appended (copy, don't mutate)