-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpipelines-14.cc
More file actions
35 lines (30 loc) · 876 Bytes
/
pipelines-14.cc
File metadata and controls
35 lines (30 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <string>
#include "eventuals/closure.h"
#include "eventuals/iterate.h"
#include "eventuals/let.h"
#include "eventuals/loop.h"
#include "eventuals/map.h"
#include "eventuals/promisify.h"
using namespace eventuals;
int main(int argc, char** argv) {
auto e = []() {
return Closure([result = std::string()]() mutable {
return Iterate({"hello", " ", "world", "!"})
>> Map([&result](std::string&& s) {
s[0] = std::toupper(s[0]);
result += std::move(s);
})
>> Loop()
>> Then([&result]() {
return std::move(result);
})
>> Then(Let([](std::string& result) mutable {
return Then([&result]() {
return std::move(result);
});
}));
});
};
CHECK_EQ("Hello World!", *e());
return 0;
}