[erlang-questions] how are implemented lists?
Richard A. O'Keefe
Mon May 25 03:36:30 CEST 2015
On 22/05/2015, at 7:04 pm, Raimo Niskanen <raimo+erlang-questions@REDACTED> wrote:
> Have a look at the brand new map data type.
It's not clear how that would help.
The original request was for
> a fast and concurrent data structure that allows me to retrieve the items
> in order and do pop/tail, while still being abble to remove them by key.
Maps are no more concurrent than lists are.
When requests like this come along, it would be nice to have a
specification that's a bit more precise. I read this as
typeclass Useful_Key key
-- at a minimum, support equality, maybe support comparison,
-- possibly equality and hashing.
data Useful_Key key => Thingy key val
empty :: Thingy key val
add :: key -> val -> Thingy key val -> Thingy key val
remove :: key -> Thingy key val -> Thingy key val
pop :: Thingy key val -> Maybe (key, val, Thingy key val)
so a sort of dictionary/list hybrid.
More information about the erlang-questions