sum as an accumulating fold; sum-++ by way of fold-++#1712
sum as an accumulating fold; sum-++ by way of fold-++#1712jamesmckinna wants to merge 1 commit intoagda:masterfrom
Conversation
|
Hmm so I have to confess I don't quite see the advantage of writing |
|
Hmmm... fair comment, except: it irked me (what a world, where my pet peeves become PRs ;-)) that the the proof of So there's a systematisation pay-off, I suppose, on the one hand, at the cost of a lemma factorisation on the other. Potayto, potahto. |
|
Hmm, I kind of see where you're coming from, but I think |
|
But for now, suggest we label this one |
At present,
Data.Vec.Base.sumspecialises the base case of its defining fold to be0.This toy/low-hanging fruit PR introduces,
in
Data.Vec.Base:fold-sum n xswith accumulating parameternsum = fold-sum 0and in
Data.Vec.Properties:fold-sum n xs ≡ sum xs + nand then a new (equivalent) proof of
sum-++usingfoldr-++and the above lemma