From 53f8c34cc1d12646d47cbe1f13f235bc05b80912 Mon Sep 17 00:00:00 2001 From: Roman Dmytruk Date: Thu, 1 Oct 2026 14:14:05 +0000 Subject: [PATCH] Update u2/list_ops.py --- u2/list_ops.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/u2/list_ops.py b/u2/list_ops.py index 248dc48..ef2f0a2 100644 --- a/u2/list_ops.py +++ b/u2/list_ops.py @@ -26,10 +26,16 @@ def length(l): return result def map(function, list): - + result = [] + for item in list + result += [function(item)] + return result def foldl(function, list, initial): - + acc = initial + for item in list: + acc = function(acc, item) + return acc def foldr(function, list, initial):