Skip to content

zip() has limits: bug or needs documenting? #20615

@cormullion

Description

@cormullion

Travis found this bug for me on 0.6: It seems that zip() can handle up to a certain number of inputs, then complains.

julia> a = 1:5
1:5

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

julia> for e in zip(a, b)
           println(e)
       end
(1, "e")
(2, "d")
(3, "b")
(4, "c")
(5, "a")

julia> for e in zip(a, b, a, b, a, b, a, b, a, b, a)
           println(e)
       end
(1, "e", 1, "e", 1, "e", 1, "e", 1, "e", 1)
(2, "d", 2, "d", 2, "d", 2, "d", 2, "d", 2)
(3, "b", 3, "b", 3, "b", 3, "b", 3, "b", 3)
(4, "c", 4, "c", 4, "c", 4, "c", 4, "c", 4)
(5, "a", 5, "a", 5, "a", 5, "a", 5, "a", 5)

julia> for e in zip(a, b, a, b, a, b, a, b, a, b, a, b)
           println(e)
       end
ERROR: type Array has no field a
Stacktrace:
 [1] start at ./iterators.jl:161 [inlined] (repeats 10 times)
 [2] anonymous at ./<missing>:?

Version

julia> versioninfo()
Julia Version 0.6.0-dev.2635
Commit dc2459d (2017-02-13 07:46 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i5-2500S CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, sandybridge)

Metadata

Metadata

Assignees

No one assigned

    Labels

    collectionsData structures holding multiple items, e.g. setscompiler:inferenceType inferenceregressionRegression in behavior compared to a previous version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions