<commit_before>/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2003-2006, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |                                         **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */

// $Id$


package scala;

import Predef.error;

object Iterable {
  def view[A <% Ordered[A]](x: Iterable[A]): Ordered[Iterable[A]] = new Ordered[Iterable[A]] {
    def compareTo[B >: Iterable[A] <% Ordered[B]](that: B): Int = that match {
      case y: Iterable[A] =>
        val xs = x.elements;
	val ys = y.elements;
	var res = 0;
	while (xs.hasNext && ys.hasNext && (res == 0)) {
          res = xs.next compareTo ys.next;
        }
	if (xs.hasNext) 1
	else if (ys.hasNext) -1
        else res;
      case _ =>
        -(that compareTo x)
    }
  }<commit_msg>made the view method implicit<commit_after>/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2003-2006, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |                                         **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */

// $Id$


package scala;

import Predef.error;

object Iterable {
  implicit def view[A <% Ordered[A]](x: Iterable[A]): Ordered[Iterable[A]] =
    new Ordered[Iterable[A]] {
      def compareTo[B >: Iterable[A] <% Ordered[B]](that: B): Int = that match {
        case y: Iterable[A] =>
          val xs = x.elements;
	  val ys = y.elements;
	  var res = 0;
	  while (xs.hasNext && ys.hasNext && (res == 0)) {
            res = xs.next compareTo ys.next;
          }
	  if (xs.hasNext) 1
	  else if (ys.hasNext) -1
          else res;
        case _ =>
          -(that compareTo x)
      }
    }
{'fraction_non_alphanumeric': 0.14279418245923314, 'fraction_numerical': 0.010577346848832084, 'mean_word_length': 0.8729372937293729, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4717559', 'n_tokens_mistral': 701, 'n_tokens_neox': 657, 'n_words': 129}