Abstract creation of sort comparison closure.