Getting First and Last Elements from a Sorted Array - Effect Community