# Difference between revisions of "Zip Command" Jump to: navigation, search

##### Zip

This article is about GeoGebra command.

##### Command Categories (All commands)

Zip[<Expression>, <Var1>, <List1>, <Var2>, <List2>, ...]
Creates list of objects obtained by substitution of variables in the expression by elements of corresponding lists. Length of the resulting list is minimum of lengths of input lists.
Example: Let P,Q,R,S,T be some points. `Zip[Midpoint[A,B],A,{P,Q},B,{R,S}]` returns a list containing midpoints of segments PR and QS.
Example: Let list1={x^2, x^3, x^6} be a list of polynomials. `Zip[Degree[a], a, list1]` returns the list {2,3,6}.

Note: In each list the elements must be of the same type.

## Comments

It's actually enough to provide a single list to Zip(). This makes it a shorter alternative to Sequence() when all you want is to traverse a list. For example, `Zip(a^2, a, listOfNumbers)` is much shorter than `Sequence(Element(listOfNumbers, a)^2, a, 1, Length(listOfNumbers))` (albeit in this case it's easier to just do `listOfNumbers^2`.) Hint: Zip() is similar to a construct known as "map" in other programming languages.
• GeoGebra
• Help
• Partners
• Contact us
• Feedback & Questions
• This email address is being protected from spambots. You need JavaScript enabled to view it.
• +43 677 6137 2693
© 2021 International GeoGebra Institute