maxpow4h/swiftz — pull request #41 by josephlord (2014-06-17 08:08:00+00:00)
Title: Add free sort functions for ImArray.

Don't know if you actually want this. It is free sort functions to bring ImArray upto the capability of the builtin array.

The current standard library implementation doesn't match the book as the array returned is the array passed in as an argument only sorted. When that is fixed the copies can be removed from these functions.

“The Sort Function
Swift’s standard library provides a function called sort, which sorts an array of values of a known type, based on the output of a sorting closure that you provide. Once it completes the sorting process, the sort function returns a new array of the same type and size as the old one, with its elements in the correct sorted order.” The test of the built in array sort will fail to let you know this can happen.

Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/gb/jEUH0.l