generalizing a length call