Special syntax for dictionaries
Sergey Samokhin
prikrutil@REDACTED
Mon May 3 21:57:19 CEST 2010
Hello!
While reading turorials of how MongoDB documents are made in
Python/Ruby, I saw one thing I ever wanted to have in Erlang:
{"author": "Mike",
"text": "My first blog post!",
"tags": ["mongodb", "python", "pymongo"],
"date": datetime.datetime.utcnow()}
That is special syntax for dictionaries.
Take a look at the slide 47 of "What are the important ideas in
Erlang?" [1] presentation by Joe Armstrong:
-----Slide 47-----
Hashmaps
foo(<{a:X, b:Y | T }>) ->
...
> foo(<{c:23, a:123, b:abc}>)
Binds X=123, Y=abc T=<{c:23}>
---------------------
Are there chances that we'll see this feature in one of the following
releases of Erlang?
I know there already are records, proplists and dict/gb_trees, but
runtime support for records is limited and it isn't possible to
pattern match on proplists (because the order of tuples may change)
and dicts.
[1] http://www.erlang-factory.com/conference/SFBay2010/speakers/joearmstrong
--
Sergey Samokhin
More information about the erlang-questions
mailing list