Skip to content

Return the destination from map! when there is nothing to map - #842

Merged
maleadt merged 1 commit into
mainfrom
tb/map-empty-return
Oct 27, 2026
Merged

maleadt merged 1 commit into
mainfrom
tb/map-empty-return

Conversation

@maleadt

@maleadt maleadt commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

map! returned nothing instead of dest when there were no elements to process. map of arguments with different lengths goes through map!, so it returned nothing too:

julia> map(+, JLArray(Int[]), JLArray([1, 2]))
# nothing; Base returns Int64[]

I ran into this while fixing #841, which builds on it.

With no elements to process, `map!` returned `nothing` instead of `dest`.
`map` of arguments with different lengths goes through `map!` and
returned `nothing` too, e.g. `map(+, empty, nonempty)`.
@maleadt
maleadt added this pull request to stack #843 October 27, 2026 14:01
@maleadt
maleadt merged commit 7597320 into main Oct 27, 2026
17 of 18 checks passed
@maleadt
maleadt deleted the tb/map-empty-return branch October 27, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant