Implement length in terms of reduce