Erlang / Erlang Advanced Interview questions
What are Erlang maps and how do they differ from records?
A map is a dynamic key-value data structure, written #{Key => Value}, where keys can be
any term and the set of keys is decided at runtime rather than fixed at compile time. A record is
syntactic sugar over a tuple with a fixed, compile-time-known set of named fields.
M = #{name => "Ada", age => 34}, Age = maps:get(age, M), M2 = M#{age => 35}. %% functional update, returns a new map
| Record | Map |
| Fixed fields, known at compile time; compiles to a plain tuple. | Dynamic keys, can vary at runtime; a distinct built-in data type. |
| Field access requires the record definition to be in scope. | Keys/values are directly inspectable without any compile-time definition. |
| Best for fixed-shape internal data (like OTP state). | Best for flexible, JSON-like, or externally-driven data. |
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
