add functions to flip arrays (and subsets) and rotate arrays