79811788

Date: 2025-11-06 21:32:25
Score: 1.5
Natty:
Report link

It's actually very easy to implement a double linked list in erlang .. you just use maps and insert items like this: {key, value, prev_key, next_key}.

When you insert in between you untie two items by picking the previous next_key and pointing to the inserted item key, and doing the same with the following prev_key . The inserted item prev/next point to the just described neighbours.

Keys can be generated internally and be as simple as progressive integers (they have no purpose, but to have a reference to look up in the map).

To answer other asking why one would need doubly linked list: LRU caches just to say?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: Riccardo Manfrin