Because the array sorts in place, and it seems good practice to copy literal constants (it does not matter much in a workspace, but it does lead to problems in actual code where the constants are stored in methods).
I could have added the sort: / sorted: distinction but I went for as little methods as possible. > On 10 Dec 2014, at 03:05, stepharo <steph...@free.fr> wrote: > > Sven > > why do you copy the array passed to sort? > > Stef > Le 8/12/14 10:36, Sven Van Caekenberghe a écrit : >> Hi, >> >> Here is another article I just published >> >> LampSort, a non-recursive QuickSort implementation >> >> The divide and conquer partitioning is at the heart of QuickSort >> >> >> https://medium.com/@svenvc/lampsort-a-non-recursive-quicksort-implementation-4d4891b217bd >> >> Pharo makes it easy to implement this non-recursive version of QuickSort - >> and beautiful as well. >> >> Sven >> >> >> > >