reading-notes

Functional Programming

What is functional programming?

a programming paradigm that emphasizes the use of pure functions to solve problems

What is a pure function and how do we know if something is a pure function?

a function that always produces the same output for a given input and has no side effects. Given the same input, it always returns the same output. It does not modify the state of the program outside of its scope. It does not depend on any mutable state that may change during program execution

What are the benefits of a pure function?

Predictability,Testability,Modularity,Parallelism,Reusability

What is immutability?

he property of an object or data structure that cannot be modified once it is created.

What is Referential transparency?

a property of a function or expression that ensures that its output or result depends only on its input or arguments, and not on any external state or context

What is a module?

a module is a self-contained unit of code that can be imported and used in another program

What does the word ‘require’ do?

indicate that a program or a particular module or component depends on another module or component to function properly.

How do we bring another module into the file the we are working in?

depends on the programming language you are using, but in general, you can do this by using an import statement or a similar mechanism provided by the language.

What do we have to do to make a module available?

first create the module and then export it using the appropriate syntax or mechanism provided by the programming language you are using.