2 ms·
> Pure functions: Functional programs are constructed using only pure functions, meaning functions that have no side effects. A function has a side effect if it
by bluefirebrand 5y ago
> Pure functions: Functional programs are constructed using only pure functions, meaning functions that have no side effects. A function has a side effect if it does anything other than simply return a result. For example, modifying global state, printing a message to the console, and mutating the DOM are all side effects.
This really makes it sound like functional programming cannot accomplish much of value.
Can't do I/O? Can't do UI? Is functional programming just for computation then? How many people even work in software that only does pure computation anymore? What good is pure computation if you can't even write it to a terminal after, because "No I/O"
This seems silly. Surely functional programming must have a broader definition than this.
- flowerlad 5y agoYou're right, in practice you're going to have some impure functions. Maybe you pissed the section titled "Functional programming in practice".