mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-06 02:26:43 +00:00
Defined referential tranparency.
This commit is contained in:
parent
aeb50cd03e
commit
cfe946aa8d
1 changed files with 20 additions and 0 deletions
20
readme.md
20
readme.md
|
|
@ -45,6 +45,18 @@ console.log(arity);
|
|||
|
||||
## Referential Transparency
|
||||
|
||||
> An expression that can be replaced with its value without changing the
|
||||
behaviour of the program is said to be referential transparent.
|
||||
|
||||
Say we have function greet:
|
||||
|
||||
```js
|
||||
let greet = () => "Hello World!";
|
||||
```
|
||||
|
||||
Any invocation of `greet()` can be replaced with `Hello World!` hence greet is
|
||||
referential transparent.
|
||||
|
||||
---
|
||||
|
||||
## Monoid
|
||||
|
|
@ -58,6 +70,14 @@ console.log(arity);
|
|||
## Functor
|
||||
> Structure that can be mapped over.
|
||||
|
||||
Simplest functor in javascript is an `Array`
|
||||
|
||||
```js
|
||||
[2,3,4].map( function(n) {
|
||||
return n + 2;
|
||||
}); // [4,6,8]
|
||||
```
|
||||
|
||||
- - -
|
||||
|
||||
## Morphism
|
||||
|
|
|
|||
Loading…
Reference in a new issue