Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well, you can filter, map and fold over maps so there is not really much missing. And they are efficient both when they are small and large.


[deleted]


I think for Scala and Clojure it does not make sense to equalize the languages with a single concurrency model, as they both build on the JVM and provide several libraries and approaches to concurrency. Scala has quite a lot of different actor implementations (std library, scalaz, akka, etc.), clojure has multiple ways (Atoms, Agents, STM, core.async) and you could even use plain java threads with mutexes or lockless data structures or green threads with Quasar/Pulsar on both.

Erlang makes it at least easier to choose a way to solve the problem, because it does not give you that much possibilities :) Erlang concurrency is probably a mix between Scala/Akka actors (unbounded queues, you send things to actors/processes, not to mailboxes) and clojure core.async (you can block inside the actor process).

The 7 concurrency models in 7 weeks book talks about all of those a little bit in case you are more interested in this topic.


[deleted]


> ...but the added chapter on maps give you errors whe using erlang 18...

Are you talking about the section entitled "What Maps Shall Be", or are you talking about the section entitled "Stubby Legs for Early Releases"?

If you're talking about the former, then the prose in the previous section "EEP, EEP!" makes it pretty clear that the maps spec is not fully implemented in Erlang, and that "What Maps Shall..." describes the spec, rather than the implementation.

If you're talking about the latter, then I'm not sure what's up on your end... the examples in "Stubby Legs..." work for me:

  Erlang/OTP 18 [erts-7.2.1] [source] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]
  
  Eshell V7.2.1  (abort with ^G)
  1> SomeMap = #{a => x}.
  #{a => x}
  2> #{a := X} = SomeMap.
  #{a => x}
  3> X.
  x
  4> SomeMap#{a := update, b => new}.
  #{a => update,b => new}
  5> Y=3, #{Y => Y-1}.
  #{3 => 2}
  6> 
> For a beginners it sound very strange that a basic structure like a maps is not well consolidated in a language as erlang.

The maps module is very, very, very new. As mentioned in the "Mexican Standoff" section, dict [0] was more-or-less the go-to module when you wanted a K/V store [1] in Erlang. The maps module [2] (and map type) adds a lot of nice syntax for working with K/V datatypes.

[0] http://erlang.org/doc/man/dict.html

[1] And had no need for ETS, or Mnesia, or similar, naturally.

[2] http://erlang.org/doc/man/maps.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: