🎉 Black Friday Sale! Save 30% when you subscribe today.

The Many Faces of Zip: Part 1

Episode #23 • Jul 23, 2018 • Subscriber-Only

The zip function comes with the Swift standard library, but its utility goes far beyond what we can see there. Turns out, zip generalizes a function that we are all familiar with, and it can unify many seemingly disparate concepts. Today we begin a multipart journey into exploring the power behind zip.

Collection
Zip
The Many Faces of Zip: Part 1
Locked

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Sign in with GitHub

Introduction

On this series we’ve done a number of “deep dives” to really analyze a topic. Things like exploring the map function to see that it’s a very universal idea and we should be comfortable defining it on our own types. And things like “contravariance”, which is kind of unintuitive at first but is really quite handy.


This often helps us see something we think we’re familiar with in a new light, or helps us see something that is very unintuitive but become comfortable with it because we develop ways to concisely manage it and transform it.


We’re doing another one of those today, and this time it’s the zip function. You’ve probably used zip a few times in your every day coding, and you probably thought it was pretty handy. But what we want to show people is that it’s a generalization of something you are already familiar with, but you may have never thought of it like this before. And once you see this generalization it really helps unify a bunch of disparate ideas.


Let’s begin by exploring the zip that comes with Swift’s standard library.

The standard library zip


Downloads

Sample code

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 64 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing