In python (and several other languages) if I have two lists and want to
process corresponding elements together I can use zip:
>>> for number, letter in zip(
… [1,2,3,4], [“a”, “b”, “c”, “d”]):
… print(number, letter)
…
1 a
2 b
3 c
4 d
The metaphor is a zipper, taking the two sides and merging them
together. It’s not perfect, since a zipper interleaves instead of
matching pairs, but it’s pretty good.
In unix, there’s a command line tool, paste that does the
same thing:
$ paste <(echo 1 2 3 4 | tr ′ ′ ‘\n’) \
<(echo a b c d | tr ′ ′ ‘\n’)
1 a
2 b
3 c
4 d
This time the metaphor is pasting: physically putting one column next
to another.
I found a discussion on
the origin of these terms, which traces paste back to at
least 1978 at Bell Labs Center 127. The earliest use of
zip I’ve found is 1988′s Introduction
to Functional Programming (p57).
What I find interesting about these names is that they’ve both “lost”
in a sense: paste and zip generally mean
something else to computer users:
Pasting is now almost always used in the “copy and
paste” sense of moving data through the computer’s clipboard from
one program to another.
Zipping is used to mean archiving, after the PKZIP
tool. Which seems to have become a metaphor only retroactively: it’s
creators called
it “ZIP” as in “zippy”, and the idea of zipping and unzipping an the
way you would a bag seems to have come later. Perhaps a retrometaphore?
Older names for this are less metaphorical: APL used the
comma-operator, and in Lisp this would
be done with the more general mapcar function.
Losing Metaphors: Zip and Paste
Link post
In python (and several other languages) if I have two lists and want to process corresponding elements together I can use
zip
:The metaphor is a zipper, taking the two sides and merging them together. It’s not perfect, since a zipper interleaves instead of matching pairs, but it’s pretty good.
In unix, there’s a command line tool,
paste
that does the same thing:This time the metaphor is pasting: physically putting one column next to another.
I found a discussion on the origin of these terms, which traces
paste
back to at least 1978 at Bell Labs Center 127. The earliest use ofzip
I’ve found is 1988′s Introduction to Functional Programming (p57).What I find interesting about these names is that they’ve both “lost” in a sense:
paste
andzip
generally mean something else to computer users:Pasting is now almost always used in the “copy and paste” sense of moving data through the computer’s clipboard from one program to another.
Zipping is used to mean archiving, after the
PKZIP
tool. Which seems to have become a metaphor only retroactively: it’s creators called it “ZIP” as in “zippy”, and the idea of zipping and unzipping an the way you would a bag seems to have come later. Perhaps a retrometaphore?Older names for this are less metaphorical: APL used the comma-operator, and in Lisp this would be done with the more general
mapcar
function.