# `Igniter.Code.List`
[🔗](https://github.com/ash-project/igniter/blob/v0.8.3/lib/igniter/code/list.ex#L5)

Utilities for working with lists.

# `equality_pred`

```elixir
@type equality_pred() :: (Sourceror.Zipper.t(), Macro.t() -&gt; boolean())
```

# `append_new_to_list`

```elixir
@spec append_new_to_list(Sourceror.Zipper.t(), quoted :: Macro.t(), equality_pred()) ::
  {:ok, Sourceror.Zipper.t()} | :error
```

Appends `quoted` to the list unless it is already present, determined by `equality_pred`.

# `append_to_list`

```elixir
@spec append_to_list(Sourceror.Zipper.t(), quoted :: Macro.t()) ::
  {:ok, Sourceror.Zipper.t()} | :error
```

Appends `quoted` to the list

# `do_move_to_list_item`

Moves to the list item matching the given predicate, assuming you are currently inside the list

# `find_list_item_index`

```elixir
@spec find_list_item_index(Sourceror.Zipper.t(), (Sourceror.Zipper.t() -&gt; boolean())) ::
  integer() | nil
```

Finds the index of the first list item that satisfies `pred`

# `list?`

```elixir
@spec list?(Sourceror.Zipper.t()) :: boolean()
```

Returns true if the `zipper` is at a list literal

# `map`

```elixir
@spec map(Sourceror.Zipper.t(), (Sourceror.Zipper.t() -&gt; {:ok, Sourceror.Zipper.t()})) ::
  {:ok, Sourceror.Zipper.t()} | :error
```

Applies the given function to every element of the list. The passed function must return `{:ok, zipper}` or `:error` When `map` returns, the Zipper will point to the final element of the list.

# `move_to_list_item`

```elixir
@spec move_to_list_item(Sourceror.Zipper.t(), (Sourceror.Zipper.t() -&gt; boolean())) ::
  {:ok, Sourceror.Zipper.t()} | :error
```

Moves to the list item matching the given predicate

# `prepend_new_to_list`

```elixir
@spec prepend_new_to_list(Sourceror.Zipper.t(), quoted :: Macro.t(), equality_pred()) ::
  {:ok, Sourceror.Zipper.t()} | :error
```

Prepends `quoted` to the list unless it is already present, determined by `equality_pred`.

# `prepend_to_list`

```elixir
@spec prepend_to_list(Sourceror.Zipper.t(), quoted :: Macro.t()) ::
  {:ok, Sourceror.Zipper.t()} | :error
```

Prepends `quoted` to the list

# `remove_from_list`

```elixir
@spec remove_from_list(
  Sourceror.Zipper.t(),
  predicate :: (Sourceror.Zipper.t() -&gt; boolean())
) ::
  {:ok, Sourceror.Zipper.t()} | :error
```

# `remove_index`

```elixir
@spec remove_index(Sourceror.Zipper.t(), index :: non_neg_integer()) ::
  {:ok, Sourceror.Zipper.t()} | :error
```

Removes the item at the given index, returning `:error` if nothing is at that index

# `replace_in_list`

```elixir
@spec replace_in_list(
  Sourceror.Zipper.t(),
  predicate :: (Sourceror.Zipper.t() -&gt; boolean()),
  term :: any()
) :: {:ok, Sourceror.Zipper.t()} | :error
```

---

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