MCPcopy Create free account
hub / github.com/Dobiasd/FunctionalPlus / problem_11

Function problem_11

examples/99_problems.cpp:89–99  ·  view source on GitHub ↗

P11 (*) Modified run-length encoding.

Source from the content-addressed store, hash-verified

87
88// P11 (*) Modified run-length encoding.
89void problem_11()
90{
91 const auto modify = [](const auto& p) -> Ints {
92 return p.first == 1 ? Ints({ p.second })
93 : Ints({ static_cast<int>(p.first), p.second });
94 };
95
96 print_result(fwd::apply(xs,
97 fwd::run_length_encode(),
98 fwd::transform(modify)));
99}
100
101// P12 (**) Decode a run-length encoded list.
102void problem_12()

Callers 1

mainFunction · 0.85

Calls 4

print_resultFunction · 0.85
applyFunction · 0.50
run_length_encodeFunction · 0.50
transformFunction · 0.50

Tested by

no test coverage detected