Simple exercise

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Mar 15 04:39:17 EDT 2016


On Tuesday 15 March 2016 16:26, Jussi Piitulainen wrote:

> Steven D'Aprano writes:
> 
>> Unfortunate or not, it seems to be quite common that "zip"
>> (convolution) discards items when sequences are of different lengths.
> 
> Citation needed. Where is zip called convolution?

Wikipedia :-)

Unfortunately "convolution" is one of those technical terms with many 
related but slightly different meanings. It's used in calculus, signal 
processing, geology, biology, probability theory, formal languages, and 
more. I don't have a citation for it being used in functional programming, 
but is it so hard to believe? A "convolution" is usually described as 
something being folded over another thing, which sounds rather like zip, 
doesn't it?

Take two pieces of paper, say one white and one black, one on top of the 
other, and fold them in half, then in half again, then again:

zero folds = W B

one fold = W B B W

two folds = W B B W W B B W


which is not that far from what zip would give you:

W B W B W B W B ...


I don't know enough about the lambda calculus and other theoretical computer 
science topics to give a definitive citation for "zip" being a convolution, 
but I do know enough to accept it as plausible.



> Why should zip be called convolution?

Why should anything be called anything?

Don't worry, I'm not suggesting that the zip function be renamed.


>> See https://en.wikipedia.org/wiki/Convolution_%28computer_science%29
> 
> "This article possibly contains original research. Please improve it by
> verifying the claims made and adding inline citations."

Meh, there are Wikipedia editors that seem to flag just about every article 
with that. You could write "water is wet" and technically that's "original 
research" that needs a citation. It is so over-used that it is practically 
meaningless.


-- 
Steve




More information about the Python-list mailing list