has function cannot be pure, due to loop construct.