DEV Community

Discussion on: Explain functional programming to me like I'm five

Collapse
 
vampiire profile image
Vamp • Edited

this is as 5 as i can get thinking about the practical aspects of FP (not all the theory)! let’s call each function an action.

each action has one distinct purpose.

each action can only work on the things you give it - it is blind to anything outside of it. meaning it can’t see or change anything outside the action.

if you put the same thing into an action you get the same thing out every time.

if you want more complex action you put in multiple actions into a composing action that performs them for you.

if you want an action that is pre-configured you call a pre-configuring action and give it some configuration information. it then gives you the pre-configured action back (with the configuration info saved in it) for you to use.

if you want to perform many sequential actions you can coordinate the output of one action as the input of the next action to get from the start to the finish one action at a time.