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