Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tarsisexistence/fuzion
shortcut fu⚡️ion for TypeScript
https://github.com/tarsisexistence/fuzion
fp functional-programming javascript shortcut-fusion typescript
Last synced: 19 days ago
JSON representation
shortcut fu⚡️ion for TypeScript
- Host: GitHub
- URL: https://github.com/tarsisexistence/fuzion
- Owner: tarsisexistence
- Created: 2021-07-10T12:25:01.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-23T04:44:21.000Z (24 days ago)
- Last Synced: 2024-10-23T15:28:53.210Z (24 days ago)
- Topics: fp, functional-programming, javascript, shortcut-fusion, typescript
- Language: TypeScript
- Homepage:
- Size: 169 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fuzion
Runtime implementation of shortcut fusion for JavaScript and TypeScript.
#### Definition ([haskell docs](https://wiki.haskell.org/Short_cut_fusion))
Shortcut fusion is an optimizer method that merges some function calls into one. E.g., `map f * map g` can be substituted by `map (f * g)`, and `filter p * filter q` can be substituted by `filter (\x -> q x && p x)`. It can also help to remove intermediate data structures. E.g., computing `sum [1..n]` does not require an explicit list structure, and the expression is actually translated into a simple loop.
#### API
So far, it supports the following operators:
- fuzion - performs left-to-right function composition. In some libraries this function is named `pipe`, `sequence`.
- map - applies another function to a list of elements and returns a new result on every element in the calling array.
- filter - invokes a provided predicate function for each array element and includes it into the result.
- forEach - executes a provided function once for each array element.
- take - cuts the length of the produced result. It helps to save operators calls to other operators on array elements that will not be included in the final result.