array slicing with wrapping