list: refactor sorting composes to a separate method
This sorting logic is useful enough to embed in other applications.
Split up the "sorting" from the "printing", introducing a new
sorted_ids() method that simply returns a list of sorted compose ID
strings.