# `InPlace.LinkedList`

[Singly linked list](https://en.wikipedia.org/wiki/Linked_list#Singly_linked_list)
The data entries are stored as integers.
They will be interpreted (as references) by the calling application.
Note: indices are 1-based.
Options:
  - `mode` :: :singly_linked | :doubly_linked
  - `circular` :: boolean()
    optional, `false` by default;
  - `deletion` :: :reclaim | :hide | :rewind
    Handles if the element pointer could be restored later (see delete_pointer/2), and how
    to restore it:
    `:reclaim` (default) - element can not be restored, the pointer will be put back to the `allocation` pool;
    `:hide` - element can be restored by re-linking with it's former `left` and `right` neighbors;
     The element stays in the list, but can not be reached
     except by directly addressed by it's pointer. The element can be put back to it's position
     by reconnecting previously prior and next elements back to that element (see hide/2 and restore/2);
    `:rewind` - if specified, the special stack of removed element pointers is maintained.
      The effect of removal will be the same as for  :hide, except that
      The elements can be restored in the reverse order of their removal by using `rewind/1`.
  - `:mapper_fun`  # maps data entries to application data
    optional, &Function.identity/1 by default

# `add_first`

# `append`

# `available`

# `circuit`

This will create a circuit out of the list of pointers.

!!!!! Hazard warning !!!!!
If you want to avoid infinite loops
while iterating over the list that contains circuits,
make sure that you start the iteration within the circuit
(using :start option fir iterate/2).

For instance
```elixir
import InPlace.LinkedList
ll = new(Enum.to_list(1..10))
circuit(ll, [2, 4, 6])
iterate, start: 1, action: fn p -> IO.inspect(p) end
```
will loop indefinitely, as the iteration will be trapped in `2 -> 4 -> 6` circuit
once entering it from `1` pointer.

# `data`

# `delete`

Delete element at `position` (1-based)

# `delete_pointer`

# `empty?`

# `get`

  Get element at `position` (1-based)

# `head`

# `inc_size`

# `insert`

Insert `data` element at `position` (1-based)

# `iterate`

# `new`

# `next`

# `pointer_deleted?`

# `prev`

# `reduce`

# `restore_pointer`

# `rewind`

# `set_data`

# `size`

# `tail`

# `to_list`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
