private static function checkArrayLengths(array $arrays) : bool
{
if (count($arrays) < 2) {
throw new Exception\BadDataException('Need at least two arrays to map over');
}
$n = count($arrays[0]);
foreach ($arrays as $array) {
if (count($array) !== $n) {
throw new Exception\BadDataException('Lengths of arrays are not equal');
}
}
return true;
}