recursively sorting an infinite list of representations