`append` for maps.
Title
Edit: This may be not very trivial when keys collide
I think append(a, b) should have b overwrite a, and to prioritze you can swap
The name append doesn't look right in this case. Maybe a new function like merge? I'm not sure.
Go has offered maps.Copy since 1.18, but it's a type-generic library function:
https://go.dev/play/p/hnaCN1yXHOF
The name
appenddoesn't look right in this case. Maybe a new function likemerge? I'm not sure.Go has offered
maps.Copysince 1.18, but it's a type-generic library function:https://go.dev/play/p/hnaCN1yXHOF
It makes sense imo, if you're adding right map to left map the right map will override the keys, appending on top