You know how in Python, if v
is a list or a dictionary, it's quite common to write functions that modify v
in place (instead of just returning the new value). I'm wondering if it is possible to write a checker that identifies such functions.
For simplicity, say you have a function f
, which only takes one argument - a
and returns in finite time (the return value is actually irrelevant). Assume also that for any input value v
, f(v)
always does the same thing (i.e. the logic inside of f
does not depend on any context or environment values - it's a pure computation on a
).
Is it possible to write a function m
, such that m(f, v)
returns True
if and only if f(v)
actually changes the original value of v
?