You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia> a =Memory{Int}([1, 2])
2-element Memory{Int64}:12
julia> b =Memory{Int}([3, 4])
2-element Memory{Int64}:34
julia>map(x->(x,), a)
2-element Memory{Tuple{Int64}}:
(1,)
(2,)
julia>map((x, y)->(x, y), a, b)
2-element Vector{Tuple{Int64, Int64}}:
(1, 3)
(2, 4)
julia>map((x, y, z)->(x, y+1, z), a, a, b)
2-element Vector{Tuple{Int64, Int64, Int64}}:
(1, 2, 3)
(2, 3, 4)
For iterations over one Memory object, the returned value of map remains a Memory. However, when iterating over multiple Memory objects, the returned type falls back to Vector. Personally, I think the return type should remain Memory for all situations when calling map since we already have a type conversion for direct broadcast on Memory:
julia> a .+ b
2-element Vector{Int64}:46
julia> a .+12-element Vector{Int64}:23
The text was updated successfully, but these errors were encountered:
MWE (on Julia 1.11.2):
For iterations over one
Memory
object, the returned value ofmap
remains aMemory
. However, when iterating over multipleMemory
objects, the returned type falls back toVector
. Personally, I think the return type should remainMemory
for all situations when callingmap
since we already have a type conversion for direct broadcast onMemory
:The text was updated successfully, but these errors were encountered: