From dc090ace5f0f1f07dbd6be6b7aa7b7e35a7a7f9a Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 25 Jun 2023 07:38:39 +0100 Subject: (*)~changed up makefile recipes, cleaned up README --- list.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'list.cpp') diff --git a/list.cpp b/list.cpp index 8697d06..aa04294 100644 --- a/list.cpp +++ b/list.cpp @@ -107,26 +107,33 @@ int main(void) std::cout << lst << std::endl; puts("Reverse list again..."); printf("Map list with f(x) = 2x: "); - map(lst = reverse(lst), [](int x) { - return x * 2; - }); + map(lst = reverse(lst), + [](int x) + { + return x * 2; + }); std::cout << lst << std::endl; puts("Reverse map..."); - map(lst, [](int x) { - return x / 2; - }); + map(lst, + [](int x) + { + return x / 2; + }); printf("Sum all numbers in list: "); std::cout << reduce( lst, - [](int a, int b) { + [](int a, int b) + { return a + b; }, 0) << std::endl; printf("Print all even numbers 1..10: "); - auto evens = filter(lst, [](int a) { - return a % 2 == 0; - }); + auto evens = filter(lst, + [](int a) + { + return a % 2 == 0; + }); std::cout << evens << std::endl; delete lst; delete evens; -- cgit v1.2.3-13-gbd6f