A programming paradigm is a style of writing code.
There are many programming paradigms available apart from the ones which we are familiar with and use in our daily life
- Imperative
- Declarative
- Object Oriented
For more information Read this
Over the last year I have been fascinated by the power of declarative programming . This paradigm focusses on “what the task is “ rather than “how the task is done”
Benefits of declarative programming
- Fewer lines of code meaning less defects
- Chaining operations
- Readable code
- Lower maintenance
Example 1
Map operation - Projects an array taking each element and transforming it.
Filter operation - Filters elements from an array that match a given condition.
The fiddle below is an illustration of how we can implement our own filter and map operations
Example 2
ConcatAll - Flattening strategy that converts an n dimensional array into an n-1 dimensional array
The fiddle below is an illustration of how we can implement our own concatAll operation
Example 3
Reduce - Reduces an array into a single element
The fiddle below is an illustration of how we can implement our own reduce operation
Filter operation - Filters elements from an array that match a given condition.
The fiddle below is an illustration of how we can implement our own filter and map operations
Example 2
ConcatAll - Flattening strategy that converts an n dimensional array into an n-1 dimensional array
The fiddle below is an illustration of how we can implement our own concatAll operation
Example 3
Reduce - Reduces an array into a single element
The fiddle below is an illustration of how we can implement our own reduce operation
The fiddle below is an illustration of how we can implement our own concatAll operation
Example 3
Reduce - Reduces an array into a single element
The fiddle below is an illustration of how we can implement our own reduce operation
The fiddle below is an illustration of how we can implement our own reduce operation