We cannot easily debug our own thought processes. It would be very different if we could look at our own thought processes as easily as a programmer reads code. For this we need a language for talking about thought. The mind has a flexibility to it which doesn't fit well with the precision and rigidity of any conventional programming language. Yet computer languages offer a starting point.
Functions are the methods for recombining data, for deriving new data from old.
A possible mental equivalent is the use of analogies. We tend to use analogies in a simplified unsophisticated way. Analogies used in such a manner are rightly suspect. Because of the danger of misuse a common pattern in thinking is to discard weak analogies rapidly. An alternative is to try to find a perspective from which the analogy is strengthened, and to continue using the analogy with caution - as a tool for discovery.