Iteration utilities

Iteration utilities

Base.Iterators.zipFunction

zip(iters...)

For a set of iterable objects, returns an iterable of tuples, where the ith tuple contains the ith component of each input iterable.

Note that zip is its own inverse: collect(zip(zip(a...)...)) == collect(a).

julia> a = 1:5
1:5

julia> b = ["e","d","b","c","a"]
5-element Array{String,1}:
 "e"
 "d"
 "b"
 "c"
 "a"

julia> c = zip(a,b)
Base.Iterators.Zip2{UnitRange{Int64},Array{String,1}}(1:5, String["e", "d", "b", "c", "a"])

julia> length(c)
5

julia> first(c)
(1, "e")
source登录查看完整内容