# Zip block - teach me how it work and the purpose of it

In dev v10, we can see inside somes blocks with block all the way option.

When i look in this block:

Surprise: the zip block:

I dont understand the Manual...

Manual extract

The list comprehension library has one block, zip. Its first input is a function of two
inputs. The two Any-type inputs are deep lists (lists of lists of…) interpreted as trees, and the
function is called with every possible combination of a leaf node of the first tree and a leaf
node of the second tree. But instead of taking atoms (non-lists) as the leaves, zip allows the leaves of each tree to
be vectors (one-dimensional lists), matrices (two-dimensional lists), etc. The Number-type inputs specify the leaf
dimension for each tree, so the function input might be called with a vector from the first tree and an atom from
the second tree.

Maybe someone can teach me slowly, with 1 or 2 examples of how it work...

Why Jen's use the zip block instead of this:

I have no idea why Jens used ZIP in LETTER.

What's more, I can believe that you don't understand the manual, since it's wrong about what ZIP does.

The manual says "every possible combination of a leaf node of the first tree and a leaf node of the second tree." But actually it combines the nth item of the first tree with the nth item of the second tree, for all n ≤ the length of the smaller list. The same n for both lists.

I have no idea why I thought it did what the manual says. I read the code and everything.

Perhaps Jens will weigh in here? I thought maybe it had to do with hyperifying the block, but I think that works for your version too.

this version of zip emulates Snap's hyperblocks.

Okay, but in that case, why not (have users) just use hyperblocks? For example:

(except that the result should be JOINed back into text).

I think it might be because of this

Yeah, I know, I can't spell

Ah, I see, I was thinking about hyperization of the first input:

That works with @loucheman's implementation.

Wait. This exact image gave me an idea, albeit a small one. Something like a [scratchblocks](letters (a) to (b) of string [Hello world!]:: operators)[/scratchblocks] type thingamabob.

You may be interested in my slicer

Why is everyone so talented, and why do they have the same ideas sooner than me?

Says one of the VERY few people Jens has decided to add their custom blocks to the official libraries

I'm ancient (not as ancient as Brian of course) so I've had years and years to come up with stuff

That block, in particular, took me about a year to get it to it's current state

I didn't think the library request from Jens would be that rare. But I'm somewhat glad it is for some reason.

I also didn't expect it, considering I joined on 2022, and compared to you, that's 3 years after you. I also had little knowledge about this programming language, and I was only making it because of some random forum post and a bit of browsing through the source.

Get used to that feeling. There are (approximately) infinitely many people in the world, so the probability of you being the best at anything is (approximately) zero. When I was in elementary school I sometimes thought I was the smartest person in the world, but as soon as I was exposed to a wider circle of friends I got over that quickly, and when I arrived at MIT I learned that I'm closer to the stupidest.

As for having the same ideas sooner, Aristotle had pretty much all the ideas 3000 years ago. And the few he didn't have were discovered by Alonzo Church in the 1930s I think.

But you should be happy to be hanging out with people who challenge you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.