improvement: never invoke .-each for an empty array.