Functions in Psychology and Programming

I am studying Functional Programming, and also William James’ Essays in Radical Empiricism, a basic text in another field: Psychology.

Let me quote from the later:

For twenty years past I have mistrusted ‘consciousness’ as an entity; Let me then immediately explain that I mean only to deny that the word stands for an entity, but to insist most emphatically that it does stand for a function.

There is, I mean, no aboriginal stuff or quality of being, contrasted with that of which material objects are made, out of which our thoughts of them are made; but there is a function in experience which thoughts perform, and for the performance of which this quality of being is invoked. That function is knowing.

I could not find such a clear and succinct definition of function in Functional Programming – and in fact, from my exposure to function in Microsoft’s Azure Cloud – I can see it is something else there (just what, I am not sure). So I have come up with one of my own (using F# terminology):

Problems can be solved by the use of modules of functions. Input data passes through these, and is transformed into output data. The functions themselves must not change – and this restriction is what makes this type of programming so important.

It also makes it applicable to programming only – everything in the real word, that we use to manage things, changes – often radically. Perhaps we should make these more stable – and our world would become more manageable.

Psychology speaks of experiences, Programming speaks of data. Functions, in either case – are what manages this basic stuff.