A sorting request needs more than an ascending arrow. Choose which fields decide the order, how ties break and whether the caller allows you to reorder the input. The slices package sorts simple ordered values and supports custom comparison functions. A comparison must return a negative value, zero or a positive value consistently; it should not change the records it compares. Stability matters only when equal keys must retain their previous order. In this lesson every task returns a new result, and record sorts use an explicit second key where the request needs deterministic output. That makes the check independent of unspecified map order or a particular sorting implementation. Include duplicates and already sorted data when you trace the result.
Sort ascending and retain duplicates.