dbulic
I would like to propose a syntax for merging maps.
Map can be updated via | operator, like %{map | key: value}
I believe it would be very useful to add a similar merge operator, like %{map || key: value, newkey: newvalue}
Trending in Discussions
The obligatory hello world thread!
Who are you and where are you from? :stuck_out_tongue:
New
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
In my third year of college, around 2010, I found Erlang. A few years later, I found Elixir. I liked the ideas at once: many small proces...
New
I’ve been tinkering with Lynx (by José) via hold_ledger. I used AI to write the code, a separate specification, the tests, and the Lean p...
New
Hi everyone! I’m the developer of PaperForge, and I’ve been working on something alongside it that I’d like your opinion on.
I’m conside...
New
A remark @Garrison made…
..has already inspired a thread for the technical side of reclaiming our internet, but there is of course anot...
New
This is where the projects in the Hologram Showcase get posted: apps built with Hologram and libraries made for it. New ones go up usuall...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #elixirconf-eu
- #security
- #processes
- #api
- #forms
- #hex










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Qqwy
Elixir already has
Map.merge/2andMap.merge/3. The latter allows to pass a function to resolve conflicts between the two maps.Why do you believe that an infix operator would make maps more usable? Also, how would this be used with structs?
In my opinion, I do not find the new operator to enhance readability. I would prefer something like:
which is already possible without changing the core language.
dbulic
Nice solution.
gregvaughn
WOW! I did not know you could just
definfix operators like that. I expected more macro-ish overhead. That’s great!Qqwy
Yes! This completely works. The only things you need to be aware of:
\\, <-, |, ~>>, <<~, ~>, <~, <~>, <|>, <<<, >>>, |||, &&&, and ^^^are not used by default (some of these are used by theBitwisemodule) and are user-overridable. (you can use the others, but then when someone uses your library they need to use e.g.import Kernel, except: [ +: 2])Oh, and an aside: all recognized operators are valid ways to start a symbol. So
:<->is fine, as is[&&&: 3].