let sort (func: 'data -> 'data -> int) (stack: 'data stack) : unit = shrink stack; Array.sort func stack.stack