Fix foldr direction and arguments order

This commit is contained in:
Maksym Kurets 2026-09-30 23:40:23 +02:00
parent bdd1eb5208
commit 90c104bead

View File

@ -40,7 +40,7 @@ def foldl(function, list, initial):
def foldr(function, list, initial):
acc = initial
for gns in list[::-1]:
acc = function(gns, acc)
acc = function(acc, gns)
return acc
def reverse(list):