[erlang-questions] Wanted additions to the maps module?
Mon May 9 16:54:32 CEST 2016
On 05/09, zxq9 wrote:
>On Monday 09 May 2016 15:22:17 Lukas Larsson wrote:
>> On Mon, May 9, 2016 at 2:54 PM, zxq9 <zxq9@REDACTED> wrote:
>> > That's my whole point. Why the desire for a next/1 and previous/1
>> > instead of a list-style operation over the map as a whole, since
>> > outside of an abstract sense of "doing something with each element"
>> > there is nothing interesting that can possibly be gained from
>> > introducing an implicit concept of order?
>Sure, internally I imagine there are a million super slick ways to use this,
>and I lack the imagination to see what they may be.
- partial iteration to look for an element
- partial iteration to only modify a subrange of the whole map; for
example, re-hashing a window of N components. If your map has 10
million items and you want to re-hash 25 of them, then going over the
whole map every time is going to eat you up on the computation (this
one is more useful with a total stable order defined)
- implementing your own map/fold/filter combination as a single pass
without needing to iterate and convert the whole map at once
- ability to do lookahead/look-behind in an iteration to arbitrary
levels without implementing your own ad-hoc zipper or buffering all of
the content you have seen
Those are a few I have in mind can be doable that way -- I've mostly
seen them at work or wanted them for ETS tables, but I'm sure someone
could twist a map into having the same requirements.
More information about the erlang-questions