Thanks for the very current information. Seems the fate of empty comprehensions was uncertain a month ago. I'm again not sure how or whether it has been resolved, but otherwise there is a lot there that I really look forward to.
The empty map type in your example seems to be what I would like and don't have in 0.4.6: it's been a struggle to get element types working under vcat or union in a function when it has empty arguments or no arguments; the mapping form of sum failed, too. tiistai 5. heinäkuuta 2016 18.11.43 UTC+3 David Gold kirjoitti: > > On this branch https://github.com/JuliaLang/julia/pull/16622 there is > > *julia> **map(length, String[])* > > *0-element Array{Int64,1}* > > > So, perhaps on 0.5 this will be "fixed". > > > > > > On Monday, July 4, 2016 at 2:58:07 PM UTC-4, Jussi Piitulainen wrote: >> >> I browsed through some Github issues where this was discussed, but I'm >> unclear on the outcome. It's complicated. >> >> Is the result of `map` on an empty array going to be typed correctly any >> time soon? Ever? In 0.5, maybe? A comprehension seems to work now (this is >> on 0.4.6, the generic Linux binary), while `map` still inherits the type >> of the empty input array: >> ```julia >> julia> cumsum(map(length, UTF8String[])) >> ERROR: BoundsError: attempt to access 0-element Array{UTF8String,1} >> at index [1] >> in cumsum at arraymath.jl:450 >> >> julia> cumsum([length(s) for s in UTF8String[]]) >> 0-element Array{Int64,1} >> >> ``` >> Some of my input arrays will be empty, so I need at least a temporary >> workaround, but should I give up on `map` altogether, or be patient? >> >
