Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/noyzys/fp-practice

* Basic functional programming concepts
https://github.com/noyzys/fp-practice

concepts fp functional-components functional-programming functor monad

Last synced: 17 days ago
JSON representation

* Basic functional programming concepts

Awesome Lists containing this project

README

        

# FP CONCEPTS

# 1. FUNCTOR:
* A Functor is a datatype that preserves structure and implements the map function.
* Preserving structure simply means that you can put a value inside and the structure itself won’t change it.
* Map (or mapper/fmap) is a function that takes a function as an argument and applies that function to the values in the structure it operates on.

# 2. MONAD:
* A monad is a structure that combines program fragments (functions), and wraps their return values in a type with additional computation.
* Example from java java.util.Optional - Monad

# 3. MONOIDS:
* A Monoid is a design pattern expressing function composition of items in a set,
is a function that takes two arguments and returns an argument of that type and it supports both the identity property.

**Pure functions ;]**
# IN KOTLIN:
* A higher-order function is a function that takes one or more functions as arguments or returns a function as a result.
* In Kotlin, We can define higher-order functions using lambda expressions. `( (A, B) -> C )`.
* Example from kotlin functor `fold`.
* A pure function doesn't depend on anything other than its input parameters.

# USE JAVA SLANG/VAVR:
* [vavr.official](https://www.vavr.io/)
* [vavr.git](https://github.com/vavr-io/vavr)
* [vavr.kotlin](https://github.com/vavr-io/vavr-kotlin)
* **PURE FUN**

# 4. SCALA
[scala.lg](https://github.com/scala)