What is functional programming?
Functional programming is a branch of programming that emphasizes a few different things, but the core tenet is immutability; which is to say, you cannot change a value once it has been set. When you do operations on lists of things, the result is a new list, not a modification of the original list. There is also a strong preference for using anonymous functions and higher-order functions (functions passed to functions) to achieve certain goals (some examples include filtering, mutation, etc).
How can you get things done when everything is immutable?
Why are modern languages (like C# and C++) inheriting more and more 'functional programming' features?
Python also has a bunch of functional programming features
Sometimes it's easy—think of list maps for example. These create a new list from an existing list, making changes along the way. No mutable state is needed for that. In other cases, it requires backflips. Input-output is a good example. Pure functional languages like Haskell do some pretty crazy stuff to maintain immutability in these situations.
Join our real-time social learning platform and learn together with your friends!