Обновить u2/list_ops.py
This commit is contained in:
parent
4a2ddc7fb3
commit
6f57f2bebf
@ -40,7 +40,7 @@ def map(function,list):
|
|||||||
def reverse(list):
|
def reverse(list):
|
||||||
result = []
|
result = []
|
||||||
for item in list:
|
for item in list:
|
||||||
result = item + result
|
result = [item] + result
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ def foldl(function,list,initial):
|
|||||||
|
|
||||||
|
|
||||||
def foldr(function,list,initial):
|
def foldr(function,list,initial):
|
||||||
return foldl(function,reverse.(list),initial)
|
return foldl(function,reverse(list),initial)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user