Can this function be pure?

Providing the 2 loc variables are in scope here, local to this function, then yes, I’d say you’re correct.