Message from JavaScript discussions
September 2018
— What do you wish to learn?
Maybe "Functional Thinking", as it states on one item from that list. actually, drop a link what you think is best you have read from functional programming.
— I haven't read that much, I mostly watch talks and such
— Okay, i see
— What you didnt hear, that imperative blocks of code, that reuse same variables, passing output to each other in last variable, maybe considered monad, pure functional why not.
— You can do impure code inside functions no problem
— As long as they have a pure interface
—
const map = (list, fn) => {
const result = [];
for (const item of list) {
result.push(fn(item));
}
return result;
};
— This is clearly imperative
— But the function itself is pure
— When called
— Since:
* There is no state between calls
* It will always return the same output for the same input