encodeCompactArray = (array, encodePassable) => {
  const chars = ['^'];
  for (const element of array) {
    const enc = encodePassable(element);
    chars.push(enc, ' ');
  }
  return chars.join('');
}
Encodes an array into a sequence of encoded elements for use in the "compactOrdered"
format, each terminated by a space (which is part of the escaped range in
"compactOrdered" encoded strings).

@param {Passable[]} array
@param {(p: Passable) => string} encodePassable
@returns {string}