https://github.com/fpdart/compose
https://github.com/fpdart/compose
dart dart2 fp funcional
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fpdart/compose
- Owner: fpdart
- License: mit
- Created: 2018-11-15T22:07:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-16T14:03:36.000Z (over 6 years ago)
- Last Synced: 2024-10-14T09:23:39.061Z (8 months ago)
- Topics: dart, dart2, fp, funcional
- Language: Dart
- Homepage: https://fpdart.github.io/compose/
- Size: 6.84 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Compose with language operators
Try to use composition functions with language operators!
You can use right (classic) and left composition.You have two ways to define your composition: `>>` and `*`. Its same!
For calling you need to use `<` (from left function) or `>` (from right function).### Examples
```dart
var addOne = (x) => x + 1;
var minusOne = (x) => x - 1;
var add = (x, v) => x + v;print(c() >> addOne >> minusOne >> ((_) => add(1, _ * 2)) > 3); // 7
print(c() >> addOne >> minusOne >> ((_) => add(1, _ * 2)) < 3); // 7print(c() * addOne * ((_) => _ * 2) > 4); // 9
print(c() * addOne * ((_) => _ * 2) < 4); // 10
```