Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map checks dimensions inconsistently #29523

Closed
cstjean opened this issue Oct 4, 2018 · 2 comments
Closed

map checks dimensions inconsistently #29523

cstjean opened this issue Oct 4, 2018 · 2 comments
Labels
arrays [a, r, r, a, y, s]

Comments

@cstjean
Copy link
Contributor

cstjean commented Oct 4, 2018

I believe that the second example should also be a DimensionMismatch, for consistency.

julia> map(<, [1, 2], [2])
ERROR: DimensionMismatch("dimensions must match")
Stacktrace:
 [1] promote_shape at ./indices.jl:154 [inlined]
 [2] axes(::Base.Iterators.Zip2{Array{Int64,1},Array{Int64,1}}) at ./iterators.jl:291
 [3] _array_for at ./array.jl:611 [inlined]
 [4] collect(::Base.Generator{Base.Iterators.Zip2{Array{Int64,1},Array{Int64,1}},getfield(Base, Symbol("##3#4")){typeof(<)}}) at ./array.jl:624
 [5] map(::Function, ::Array{Int64,1}, ::Array{Int64,1}) at ./abstractarray.jl:2060
 [6] top-level scope at none:0

julia> map(<, [1 2], [2])
1-element Array{Bool,1}:
 true
@BioTurboNick
Copy link
Contributor

BioTurboNick commented Oct 22, 2019

My issue #33635 is related although different. Scalar inputs are treated like iterables with 1 element, and that issue documents other potentially inconsistent behavior with e.g. generators and tuples as arguments.

As a user, I would wish map()/pmap() to enforce size wherever possible. If a user desires the iterable-as-many-as-possible behavior, I'd argue they should be explicit about that.

@mschauer
Copy link
Contributor

Resolved by #29927

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s]
Projects
None yet
Development

No branches or pull requests

5 participants