Giter Site home page Giter Site logo

unzip.jl's People

Contributors

bramtayl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lilithhafner

unzip.jl's Issues

New release?

Can we have a new release that includes the fix for #3?

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Error when unzipping Array of `GeometryBasics.Point2`s

using GeometryBasics
using Unzip
const P2  = GeometryBasics.Point2
unzip([P2((0.2,0.3)), P2((0.1,2.0))])

Results in

ERROR: MethodError: Cannot `convert` an object of type Float64 to an object of type Tuple{Float64, Float64}
Closest candidates are:
  convert(::Type{T}, ::T) where T<:Tuple at ~/.asdf/installs/julia/1.7.2/share/julia/base/essentials.jl:336
  convert(::Type{T}, ::Tuple{Vararg{Any, N}}) where {N, T<:Tuple} at ~/.asdf/installs/julia/1.7.2/share/julia/base/essentials.jl:337
  convert(::Type{T}, ::CartesianIndex) where T<:Tuple at ~/.asdf/installs/julia/1.7.2/share/julia/base/multidimensional.jl:137
  ...
Stacktrace:
  [1] setindex!(A::Vector{Tuple{Float64, Float64}}, x::Float64, i1::Int64)
    @ Base ./array.jl:903
  [2] #5
    @ ~/.julia/packages/Unzip/Yiepw/src/Unzip.jl:82 [inlined]
  [3] (::Base.var"#4#5"{Unzip.var"#5#6"{Tuple{Int64}}})(a::Tuple{Vector{Tuple{Float64, Float64}}, Float64})
    @ Base ./generator.jl:36
  [4] iterate
    @ ./generator.jl:47 [inlined]
  [5] collect(itr::Base.Generator{Base.Iterators.Zip{Tuple{Tuple{Vector{Tuple{Float64, Float64}}}, GeometryBasics.Point2{Float64}}}, Base.var"#4#5"{Unzip.var"#5#6"{Tuple{Int64}}}})
    @ Base ./array.jl:724
  [6] map(::Function, ::Tuple{Vector{Tuple{Float64, Float64}}}, ::GeometryBasics.Point2{Float64})
    @ Base ./abstractarray.jl:2948
  [7] setindex!
    @ ~/.julia/packages/Unzip/Yiepw/src/Unzip.jl:81 [inlined]
  [8] copyto_unaliased!(deststyle::IndexCartesian, dest::Unzip.Rows{Tuple{Tuple{Float64, Float64}}, 1, Tuple{Vector{Tuple{Float64, Float64}}}}, srcstyle::IndexLinear, src::Vector{GeometryBasics.Point2{Float64}})
    @ Base ./abstractarray.jl:1032
  [9] copyto!
    @ ./abstractarray.jl:998 [inlined]
 [10] _collect(cont::Unzip.Rows{Tuple{}, 1, Tuple{}}, itr::Vector{GeometryBasics.Point2{Float64}}, #unused#::Base.HasEltype, isz::Base.HasShape{1})
    @ Base ./array.jl:655
 [11] unzip(rows::Vector{GeometryBasics.Point2{Float64}})
    @ Unzip ~/.julia/packages/Unzip/Yiepw/src/Unzip.jl:264
 [12] top-level scope
    @ REPL[46]:1

Can't unzip BlockVector

Not sure if this is a bug in Unzip or BlockArrays

julia> using Unzip, BlockArrays

julia> m = mortar([Matrix(rand(i,j)) for i=1:2, j=1:3]);

julia> cblocks = [(rand(),rand()) for c in eachcol(m)];

julia> cblocks isa AbstractVector{<:Tuple}
true

julia> unzip(cblocks)
ERROR: type BlockArray has no field columns
Stacktrace:
 [1] getproperty(x::BlockVector{Tuple{Float64, Float64}, Vector{Vector{Tuple{Float64, Float64}}}, Tuple{BlockedUnitRange{Vector{Int64}}}}, f::Symbol)
   @ Base .\Base.jl:33
 [2] unzip(rows::PseudoBlockVector{Tuple{Float64, Float64}, Vector{Tuple{Float64, Float64}}, Tuple{BlockedUnitRange{Vector{Int64}}}})
   @ Unzip C:\Users\sternlab\.julia\packages\Unzip\x2oA5\src\Unzip.jl:249
 [3] top-level scope
   @ REPL[60]:1

BoundsError or MethodError for some heterogenous collections

unzip( [(1, 2), (3, 4)] )                        # OK
unzip( x for x in [(1, 2), (3, 4)] )             # OK
unzip( [(1, 2), ("a", "b")] )                    # OK
unzip( x for x in [(1, 2), ("a", "b")] )         # MethodError: no method matching widen_column(::Base.HasLength, ::Int64, ::Int64, ::Vector{Int64}, ::String)
unzip( [(a=1, b=2), (a=3, b=4)] )                # OK
unzip( x for x in [(a=1, b=2), (a=3, b=4)] )     # OK
unzip( [(a=1, b=2), (a="a", b="b")] )            # BoundError: attempt to access 0-element Unzip.Rows{Tuple{}, 1, Tuple{}} at index [1, 2]
unzip( x for x in [(a=1, b=2), (a="a", b="b")] ) # MethodError: no method matching widen_column(::Base.HasLength, ::Int64, ::Int64, ::Vector{Int64}, ::String)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.