def child(index = nil)
      unless index
        raise ArgumentError, 'No index for node with degree != 1' if degree != 1
        return first
      end

      rtl, index = wrap_index index

      raise RangeError, 'Child index out of range' if index >= degree

      children(rtl: rtl).each do |c|
        break c if index.zero?
        index -= 1
      end
    end
def child(index = nil)
      unless index
        raise ArgumentError, 'No index for node with degree != 1' if degree != 1
        return first
      end

      rtl, index = wrap_index index

      raise RangeError, 'Child index out of range' if index >= degree

      children(rtl: rtl).each do |c|
        break c if index.zero?
        index -= 1
      end
    end
Accessor method for any of the n children under this node. If called
 without an argument and the node has anything but exactly one child an
 exception will be raised.

 @param index [Integer] the n:th child to be returned. If the index is
   negative the indexing will be reversed and the children counted from the
   last to the first.
 @return [Node] the child at the n:th index.