FUNCTIONAL PROGRAMMING

nod.js arch

functional programming

Functional programming languages are specially designed to handle symbolic computation and list processing applications. Functional programming is based on mathematical functions. Some of the popular functional programming languages include: Lisp, Python, Erlang, Haskell, Clojure, etc.Functional programming is a programming paradigm — a style of building the structure and elements of computer programs — that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data

## Pure Functions

A pure function is a function which: Given the same input, will always return the same output. Produces no side effects . A pure function is a function where the return value is only determined by its input values, without observable side effects. This is how functions in math work: Math. cos(x) will, for the same value of x , always return the same result. Computing it does not change x .

benefit of pure

Pure functions are much easier to read and reason about. All relevant inputs and dependencies are provided as parameters, so no effects are observed that alter variables outside of the set of inputs. This means that we can quickly understand a function and its dependencies, just by reading the function’s declaration.

immutability

the state of not changing, or being unable to be changed: His poetry conveys a sense of the immutability of nature.the state of not changing, or being unable to be changed: His poetry conveys a sense of the immutability of nature.

Referential transparency

Referential transparency and referential opacity are properties of parts of computer programs. An expression is called referentially transparent if it can be replaced with its corresponding value without changing the program’s behavi.

A function is referentially transparent if it’s a pure function whose parameters are immutable. … To achieve this in JavaScript we use immutable-js to create immutable data, and closures to make sure observers can’t introspect our object and mutate its state.

a module

Module in Node. js is a simple or complex functionality organized in single or multiple JavaScript files which can be reused throughout the Node. js application. Each module in Node. js has its own context, so it cannot interfere with other modules or pollute global scope.

require

1a : to claim or ask for by right and authority. b archaic : request. 2a : to call for as suitable or appropriate the occasion requires formal dress. b : to demand as necessary or essential : have a compelling need for all living beings require food. 3 : to impose a compulsion or command on : compel.

require in node.js

The require function is Node. js’s mechanism for breaking up large projects into small, manageable files. The require function lets you includefunctions from external modules and other files in a clean and elegant way. You already used the require function. once before in order to include the MongoDB Node.

import a module

  1. Save this code in a file named mymodule.
  2. Import the module named mymodule, and call the greeting function

  3. Save this code in the file mymodule

  4. Import the module named mymodule, and access the person1 dictionary

Things I want to know more about

more and more about the node.js

for more info please visit my github

## qusaiqeisi

best regard