4 ms·
That last paragraph really helped make this clear. Thanks! I guess I never thought about it that way but the logic in the loops could be considered their own f
by rifung 12y ago
That last paragraph really helped make this clear. Thanks!
I guess I never thought about it that way but the logic in the loops could be considered their own functions, except they actually can reference and alter variables outside the loop which is kind of against the ideas of functional programming.
Awesome! Thanks again
- angersock 12y agoGlad I could help! One last thing: the core idea of functional programming is mapping state to state, the same way a transform matrix maps a vector to another vector. So, to accomplish something, you string together functions to map you from the state you have to an ultimate state that you want. For something like calculating the average of a set of numbers, this would be: [ set of numbers ] -> function maps from the "set of numbers space" to the "sum of all numbers in a set space" --> function that maps from the "number space" to the "number space scaled by a value (here being the number of original numbers in the set)" --> your final mean