optimize IList#scanLeft, scanRight