def merge(&comparator)
      raise Erlang::ImproperListError if improper?
      return merge_by unless block_given?
      sorted = reject(&:empty?).sort do |a, b|
        yield(a.head, b.head)
      end
      return Erlang::Nil if sorted.empty?
      return Erlang::Cons.new(sorted.head.head, sorted.tail.cons(sorted.head.tail).merge(&comparator))
    end
def merge(&comparator)
      raise Erlang::ImproperListError if improper?
      return merge_by unless block_given?
      sorted = reject(&:empty?).sort do |a, b|
        yield(a.head, b.head)
      end
      return Erlang::Nil if sorted.empty?
      return Erlang::Cons.new(sorted.head.head, sorted.tail.cons(sorted.head.tail).merge(&comparator))
    end
Merge all the nested lists into a single list, using the given comparator
 block to determine the order which items should be shifted out of the nested
 lists and into the output list.

 @example
   list_1 = Erlang::List[1, -3, -5]
   list_2 = Erlang::List[-2, 4, 6]
   Erlang::List[list_1, list_2].merge { |a,b| a.abs <=> b.abs }
   # => Erlang::List[1, -2, -3, 4, -5, 6]

 @return [List]
 @yield [a, b] Pairs of items from matching indices in each list.
 @yieldreturn [Integer] Negative if the first element should be selected
                        first, positive if the latter element, or zero if
                        either.