def chunk(number)
      raise Erlang::ImproperListError if improper?
      return self if empty?
      out = tail = Erlang::Cons.allocate
      list = self
      until list.empty?
        first, list = list.split_at(number)
        new_node = Erlang::Cons.allocate
        new_node.instance_variable_set(:@head, first)
        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
      end
      if not tail.immutable?
        tail.instance_variable_set(:@tail, Erlang::Nil)
        tail.immutable!
      end
      return out.tail
    end
def chunk(number)
      raise Erlang::ImproperListError if improper?
      return self if empty?
      out = tail = Erlang::Cons.allocate
      list = self
      until list.empty?
        first, list = list.split_at(number)
        new_node = Erlang::Cons.allocate
        new_node.instance_variable_set(:@head, first)
        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
      end
      if not tail.immutable?
        tail.instance_variable_set(:@tail, Erlang::Nil)
        tail.immutable!
      end
      return out.tail
    end
Split the items in this list in groups of `number`. Return a list of lists.

 @example
   ("a".."o").to_list.chunk(5)
   # => Erlang::List[
   #      Erlang::List["a", "b", "c", "d", "e"],
   #      Erlang::List["f", "g", "h", "i", "j"],
   #      Erlang::List["k", "l", "m", "n", "o"]]

 @return [List]