pub fn concat_lists(
left: Value,
right_elems: &[Value],
) -> Result<Value, EvalError>Expand description
Concatenate two Nix lists: left ++ right_elems.
left must be a Value::List; right_elems is the right list’s element
slice. When left’s backing Rc<Vec> is uniquely owned (a fresh
temporary, as in a left-associative acc ++ [x] fold), the right elements
are appended IN PLACE — amortized O(1) instead of the O(n) full clone that
left.to_vec() would cost. When the Rc is shared, the shared list is
left untouched and a fresh clone-extended Vec is built (identical to the
prior to_vec() + extend_from_slice path).
§Byte-neutrality
PROVABLY-NEUTRAL. Both paths produce the identical ordered sequence of the
same Rc-shared lazy Value thunks — no element is forced, reordered, or
re-identified. The only observable difference is heap allocation reuse,
which is not a Nix-observable property. See docs/PERF-ARSENAL.md.