You are talking about referential transparency. Even functions that are not pure can be referentially transparent.