scanl in python

B

bonono

I think that the test for an empty iterator makes ireduce() unintuitive. Try
asking someone who has not followed the discussion
what list(ireduce(add, [], 42)) might produce, given that
list(ireduce(add, [1], 42)) --> [43]
list(ireduce(add, [1, 2], 42)) --> [43, 45]
list(ireduce(add, [])) --> []
list(ireduce(add, [1])) --> [1]
list(ireduce(add, [1, 2])) --> [1, 3]
I suspect that [42] will be a minority vote.

Don't know about the intend, but if it is duplicate of scanl(say on
Haskell), it is :

list(ireduce(add, [1], 42)) --> [42, 43]
list(ireduce(add, [1, 2], 42)) --> [42, 43, 45]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,271
Messages
2,571,357
Members
48,042
Latest member
DoraMcBrie

Latest Threads

Top