From 495c08602fdc74f8c474d71a5e3cb358d3e580d4 Mon Sep 17 00:00:00 2001 From: q66 Date: Sat, 18 Mar 2017 01:08:21 +0100 Subject: [PATCH] simplify example --- examples/concurrency.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/examples/concurrency.cc b/examples/concurrency.cc index f70bd33..e540fcf 100644 --- a/examples/concurrency.cc +++ b/examples/concurrency.cc @@ -13,11 +13,7 @@ void foo() { auto c = sched.make_channel(); auto f = [&c](auto half) { - int ret = 0; - for (int i: half) { - ret += i; - } - c.put(ret); + c.put(foldl(half, 0)); }; sched.spawn(f, h1); sched.spawn(f, h2);