     [fun.(value) | list]
   end
 
-  defp do_update_at(list, index, _fun) when index < 0 do
-    list
-  end
-
   defp do_update_at([head | tail], index, fun) do
     [head | do_update_at(tail, index - 1, fun)]
   end

    [value]
  end

  defp do_insert_at(list, index, value) when index <= 0 do
    [value | list]
  end



  """
  @spec insert_at(list, integer, any) :: list
  def insert_at(list, index, value) when is_list(list) and is_integer(index) do
    case index do
      -1 ->
        list ++ [value]

      _ when index < 0 ->
        case length(list) + index + 1 do
          index when index < 0 -> [value | list]
          index -> do_insert_at(list, index, value)
        end

      _ ->
        do_insert_at(list, index, value)
    end
  end

