def indices(object = Erlang::Undefined, i = 0, &block)
      raise Erlang::ImproperListError if improper?
      object = Erlang.from(object) if object != Erlang::Undefined
      return indices { |item| item == object } if not block_given?
      return Erlang::Nil if empty?
      out = tail = Erlang::Cons.allocate
      list = self
      until list.empty?
        if yield(list.head)
          new_node = Erlang::Cons.allocate
          new_node.instance_variable_set(:@head, i)
          new_node.instance_variable_set(:@improper, false)
          tail.instance_variable_set(:@tail, new_node)
          tail.instance_variable_set(:@improper, false)
          tail.immutable!
          tail = new_node
          list = list.tail
        else
          list = list.tail
        end
        i += 1
      end
      if not tail.immutable?
        tail.instance_variable_set(:@tail, Erlang::Nil)
        tail.immutable!
      end
      return out.tail
    end
def indices(object = Erlang::Undefined, i = 0, &block)
      raise Erlang::ImproperListError if improper?
      object = Erlang.from(object) if object != Erlang::Undefined
      return indices { |item| item == object } if not block_given?
      return Erlang::Nil if empty?
      out = tail = Erlang::Cons.allocate
      list = self
      until list.empty?
        if yield(list.head)
          new_node = Erlang::Cons.allocate
          new_node.instance_variable_set(:@head, i)
          new_node.instance_variable_set(:@improper, false)
          tail.instance_variable_set(:@tail, new_node)
          tail.instance_variable_set(:@improper, false)
          tail.immutable!
          tail = new_node
          list = list.tail
        else
          list = list.tail
        end
        i += 1
      end
      if not tail.immutable?
        tail.instance_variable_set(:@tail, Erlang::Nil)
        tail.immutable!
      end
      return out.tail
    end
Return a `List` of indices of matching objects.

 @overload indices(object)
   Return a `List` of indices where `object` is found. Use `#==` for
   testing equality.

   @example
     Erlang::List[1, 2, 3, 4].indices(2)
     # => Erlang::List[1]

 @overload indices
   Pass each item successively to the block. Return a list of indices
   where the block returns true.

   @yield [item]
   @example
     Erlang::List[1, 2, 3, 4].indices { |e| e.even? }
     # => Erlang::List[1, 3]

 @return [List]