How to do a simple sum of two msgs which are arrays

For the record, there are a couple ways I can think of to do this with a JSONata expression -- but if you know you will only have 2 arrays, you can "zip" them together (put matching index elements into their own arrays), and them pass the list to the sum function:

$zip(payload[0],payload[1]).$sum(*)

Another way is the build an object keyed on the array index, and then pull out only the values:

([0..$count(payload)-1].(
	$idx := $;
    {
		$string($idx): $$.payload.*[$idx]~>$sum
	}
)~>$merge()).*