I had an analogous experience when learning programming for the first time related to the return type of a function—that if you have a function like “int myFunction()” it in some sense “is” an integer, and so the function call can be substituted anywhere that you could use a literal integer (like 3).
Of course it’s not quite that simple in most programming languages since impure functions can have side effects that have nothing to do with the return value, but it was still a helpful realization.
I had an analogous experience when learning programming for the first time related to the return type of a function—that if you have a function like “int myFunction()” it in some sense “is” an integer, and so the function call can be substituted anywhere that you could use a literal integer (like 3).
Of course it’s not quite that simple in most programming languages since impure functions can have side effects that have nothing to do with the return value, but it was still a helpful realization.