3 ms·
Because the purpose of capslock is specifically to create stateful behavior, you program capslock exactly as it is now (or you eliminate it from the keyboard as
by brudgers 13y ago
Because the purpose of capslock is specifically to create stateful behavior, you program capslock exactly as it is now (or you eliminate it from the keyboard as is advocated from time to time).
It's no different than reading from a file - the state is out in the world and to be useful, a functional program must deal with it.
But note that the key difference is that the programmer does not create the state - it comes from the data. Probably also worth noting that the keyboard is used as an illustrative analogy not as example code.