Examples for sorted and flatmap