In this session we will go over the fundamentals of functional programming and see how functional programming can help make our code more reusable, stable, scalable and fun.
11. Pure Function
Pure functions act on their
parameters
Are not efficient if not returning
anything
Will always produce the same output
for the given parameters
Have NO side affects
39. Map
Creates a new array with the results
of calling a provided function on
every element in the array
41. Filter
Creates a new array with all
elements that pass the test
implemented by the provided
function
43. Reduce
Applies a function against an
accumulator and each value of the
array (from left-to-right) to reduce
it to a single value
45. Summary
Use “Pure” functions to create predictable &
stable code
Use Immutable structs to avoid side effects
Compose complex functionality from
simple building blocks
Use currying for simple composition
Avoid “boilerplate” code and loops by using
functional functions