[erlang-questions] Wanted additions to the maps module?

Michael Truog <>
Tue May 10 02:56:46 CEST 2016


On 05/09/2016 05:41 PM, Richard A. O'Keefe wrote:
>
>
> On 10/05/16 1:43 AM, Artie Gold wrote:
>> Old naïvist here...
>>
>> Why should a defined order be necessary in an immutable context?
> To produce consistent results.
>

If we have maps:first(Map) return an Iterator type with maps:next(Iterator, Map) we can provide in-order results if all the keys are stored in-order in a list (within the Iterator data type). This approach would likely consume way more memory than is necessary with other data structure usage, but paying for the computational time to get all the keys in-order before iterating may be worth it. If the map already is guilty of consuming large amounts of memory, extra memory for an iterator doesn't seem like a large sin.  So, it seems like there can still be hope that a map provide a defined order.

>
> I can sort of cope with library modules that make my life
> hard, but I expect better of basic data structures.
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list