When a function is dropped, any prepared statements which reference it need to be removed from the prepared statement cache.
The default implementation of Term#usesFunction in Term.NonTerminal is not overriden in all the places it should be. The DelayedValue classes in Lists, Sets, Maps and Tuples may all make use of function calls.
a prepared statement of the form:
should be dropped when ks.echo_int(int) is, but currently that isn't the case.