Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/christianparpart/compose
Functional Programming in C++14
https://github.com/christianparpart/compose
cpp cpp11 cpp14 functional-programming library
Last synced: 3 days ago
JSON representation
Functional Programming in C++14
- Host: GitHub
- URL: https://github.com/christianparpart/compose
- Owner: christianparpart
- License: mit
- Created: 2017-04-28T13:48:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-02T18:51:55.000Z (almost 8 years ago)
- Last Synced: 2024-12-16T11:53:01.398Z (about 2 months ago)
- Topics: cpp, cpp11, cpp14, functional-programming, library
- Language: C++
- Size: 13.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Compose
That's my little library for allowing myself to code in fuctional style in C++14.
### Example
```cpp
#include "compose.h"
#includeint main() {
auto v = {1, 2, 3, 4, 5, 6, 7, 8};auto range = compose(v)
.map([](auto x) { return x * x; })
.select([](auto x) { return !(x % 2); })
.take(3);for (auto a: range) {
std::cout << "a: " << a << std::endl;
}
}
```### Functions API
- `map(func)`
- `select(predicate)`
- `take(count)`
- `fold(init, func)`
- `size()`
- ... (more to come, by dragons)### TODO
- support more functional patterns, such as zip, foldLeft, ...