Use foldl1 for non-empty lists only