What is the reason behind Array#zip's name?

K

Kevin

[Note: parts of this message were removed to make it a legal post.]

I'm just curious I know that Array#zip generates a new array from arguments
passed to it. What I don't get is why it is called zip. Is it because of
how the results are computed into the new array?
 
J

Jeremy Bopp

I'm just curious I know that Array#zip generates a new array from arguments
passed to it. What I don't get is why it is called zip. Is it because of
how the results are computed into the new array?

I think it's inherited from a similarly named function that carries out
the same operation in some functional programming languages. I remember
first being introduced to it in Haskel, but I'm sure it's been around
longer.

In any case, you can think of the basic operation of zip as being like a
zipper, linking pairs of elements together at the same index in each
array. The arrays have been zipped together. This has been generalized
for n arrays, but the concept is the same.

-Jeremy
 
K

Kevin

[Note: parts of this message were removed to make it a legal post.]

Haskell happened to be the second place I have seen this particular function
as well. What you said makes lots of sense.
 

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

No members online now.

Forum statistics

Threads
474,260
Messages
2,571,039
Members
48,768
Latest member
first4landlord

Latest Threads

Top