« first day (332 days earlier)      last day (361 days later) » 

16:23
Any Erlang experts here? I am looking for something C++ std::multi_map like in Erlang.
 
3 hours later…
user1804599
19:49
@bamboon The next version of Erlang will have maps, so you could write something like std::multimap easily using maps of lists.
user1804599
room topic changed to Functional Programming: λf.(λx.f (x x)) (λx.f (x x)) [clojure] [elixir] [erlang] [f#] [haskell] [linq] [lisp] [ml] [scala]
user1804599
20:24
Say I have (def data {:inventory '(), :health 1.0}).
user1804599
Is there a more elegant way to do (assoc data :inventory (cons :apple (get data :inventory))?
user1804599
Something like (assocmap data :inventory #(cons :apple %)).
user1804599
I could write it myself; (defn assocmap [map key f] (assoc map key (f (get map key)))) but maybe there is a function in the standard library?
@rightfold cool. Do you have a source/linky?
user1804599
20:48
@bamboon Armstrong mentioned it in the second edition of Programming Erlang.
21:16
@rightfold ah ok, thanks
user1804599
The current version is R16B.
user1804599
R17 will have maps.
Yeah, I know that. Are there any plans on when R17 will be released?
user1804599
1> F1 = #{ a => 1, b => 2 }.
#{ a => 1, b => 2 }
user1804599
@bamboon I have no idea.
user1804599
21:24
@bamboon As for R16 I’d just go with keyword lists.
user1804599
Another option is ETS although that may be overkill.
user1804599
22:02
Ah, I was looking for update-in.
user1804599
(defn heal [st n] (update-in st [:health] #(+ % n)))

« first day (332 days earlier)      last day (361 days later) »