☰
sort
🌌sortedArray.sort
perform heap sort on the given array
result is a new array that is sorted
h1 is the mutable index within the current first heap, this is updated
by the function passed to the array constructor.
NYI: This might eventually be done using a monad with monadic lifting
of array.