Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/noyzys/fp-practice
- Owner: noyzys
- Created: 2024-03-01T15:39:54.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-01T15:58:30.000Z (11 months ago)
- Last Synced: 2024-11-13T19:42:05.512Z (3 months ago)
- Topics: concepts, fp, functional-components, functional-programming, functor, monad
- Language: Kotlin
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)