From 0d631f7eb5c30ce33bef954c3ec7057591999da8 Mon Sep 17 00:00:00 2001 From: Roman Dmytruk Date: Thu, 1 Oct 2026 14:22:24 +0000 Subject: [PATCH] Update u2/list_ops.py --- u2/list_ops.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/u2/list_ops.py b/u2/list_ops.py index ef2f0a2..29a5cf9 100644 --- a/u2/list_ops.py +++ b/u2/list_ops.py @@ -38,5 +38,13 @@ def foldl(function, list, initial): return acc def foldr(function, list, initial): + acc = initial + for acc in list: + acc = function(acc, item) + return acc def reverse(list): + result = [] + for item in list: + result = [item] + result + return result \ No newline at end of file