A function that reverses a list, in place