3 ms·
There is a difference between a function `f` and the expression `x + 2` in your example. In fact, `f` as a function completely hides the expression from which i
by danharaj 8y ago
There is a difference between a function `f` and the expression `x + 2` in your example. In fact, `f` as a function completely hides the expression from which it was defined. Usually functions are considered equal if they have the same values at every point. The upshot is, you can define a function from two different expressions and they can end up being the "same" function. This is indeed the hiding of some information.
In the composition of functions, f . g (x) = f(g(x)), that there is a result of g(x) is hidden by the composition, which only allows examination of the first input and the final output.
There is nothing special about OOP here.
- lmm 8y ago> There is a difference between a function `f` and the expression `x + 2` in your example. In fact, `f` as a function completely hides the expression from which it was defined. Usually functions are considered equal if they have the same values at every point. The upshot is, you can define a function from two different expressions and they can end up being the "same" function. This is indeed the hiding of some information. It's hiding the differing constructions, but at that point I don't see that as a true difference. (\x . x + 2) . (\x . x + 2) seems to me to be the same value as \x . x + 4 in exactly the same way that 2 + 2 is the same value as 4. > In the composition of functions, f . g (x) = f(g(x)), that there is a result of g(x) is hidden by the composition, which only allows examination of the first input and the final output. > There is nothing special about OOP here. Having mutable state hidden/encapsulated with a bundle of functions that may be entangled with that state is unique to OOP; as I said in the side thread, hidden structure is not the same as hidden state.