The ecological causes of functional distinctiveness in communities