Fix foldr direction and arguments order
This commit is contained in:
parent
bdd1eb5208
commit
90c104bead
@ -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):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user