As per this thread in SO, reduce
is equivalent to fold. However, in Haskell, accum parameter is also passed to fold. What is the way in python to pass accumulator in reduce
.
my_func(accum, list_elem):
if list_elem > 5:
return accum and True # or just accum
return accum and False # or just False
reduce(my_func, my_list)
Here, I want to pass True
as accumulator. What is the way in python to pass initial accumulator value.