summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/Traversable.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-08-27 02:18:46 +0000
committerPaul Phillips <paulp@improving.org>2009-08-27 02:18:46 +0000
commit8949b0f2557f016d9074eecceed0f47ad16e37ea (patch)
tree9d22c68e6492c9d7e6b7f0292af9afe73527e1b3 /src/library/scala/collection/Traversable.scala
parent7c20966e50a7eb25594c3efd1f0b01340f0bcd20 (diff)
downloadscala-8949b0f2557f016d9074eecceed0f47ad16e37ea.tar.gz
scala-8949b0f2557f016d9074eecceed0f47ad16e37ea.tar.bz2
scala-8949b0f2557f016d9074eecceed0f47ad16e37ea.zip
Removed ComparableTraversableOps and NumericTra...
Removed ComparableTraversableOps and NumericTraversableOps in favor of methods directly on Traversable. We can revisit this, but for the time being I think it'd be wise to reduce the use of implicits wherever we can easily do so.
Diffstat (limited to 'src/library/scala/collection/Traversable.scala')
-rw-r--r--src/library/scala/collection/Traversable.scala54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/library/scala/collection/Traversable.scala b/src/library/scala/collection/Traversable.scala
index 9998e02242..1a8ca8a621 100644
--- a/src/library/scala/collection/Traversable.scala
+++ b/src/library/scala/collection/Traversable.scala
@@ -103,48 +103,6 @@ object Traversable extends TraversableFactory[Traversable] { self =>
def newBuilder[A]: Builder[A, Traversable[A]] = immutable.Traversable.newBuilder[A]
- /** A wrapper class which adds `min` and `max` methods to iterables of an element type that has an Ordering.
- */
- class ComparableTraversableOps[A](self: Traversable[A], cmp: Ordering[A]) {
-
- /** Returns the minimal element of the wrapped iterable `self` with respect to the given ordering `cmp` */
- def min: A = {
- require(!self.isEmpty, "min(<empty>)")
- var acc = self.head
- for (x <- self)
- if (cmp.lt(x, acc)) acc = x
- acc
- }
-
- /** Returns the maximal element of the wrapped iterable `self` with respect to the given ordering `cmp` */
- def max: A = {
- require(!self.isEmpty, "max(<empty>)")
- var acc = self.head
- for (x <- self)
- if (cmp.gt(x, acc)) acc = x
- acc
- }
- }
-
- /** A wrapper class which adds `sum` and `product` methods to iterables of an element type that is `Numeric`.
- */
- class NumericTraversableOps[A](self: Traversable[A], num: Numeric[A]) {
-
- /** Returns the sum of all elements of the wrapped iterable `self` with respect to the numeric operations in `num` */
- def sum: A = {
- var acc = num.zero
- for (x <- self) acc = num.plus(acc, x)
- acc
- }
-
- /** Returns the product of all elements of the wrapped iterable `self` with respect to the numeric operations in `num` */
- def product: A = {
- var acc = num.one
- for (x <- self) acc = num.times(acc, x)
- acc
- }
- }
-
/** A wrapper class which adds `flatten` and `transpose` methods to iterables or iterable element type`.
*/
class TraversableTraversableOps[This <: Traversable[Traversable[A]], A](self: This) {
@@ -192,18 +150,6 @@ object Traversable extends TraversableFactory[Traversable] { self =>
}
}
- /** Implicit wrapper conversion of iterables with elements admitting comparison.
- * @see ComparableTraversableOps
- */
- implicit def comparableTraversableWrapper[A](self: Traversable[A])(implicit cmp: Ordering[A]) =
- new ComparableTraversableOps(self, cmp)
-
- /** Implicit wrapper conversion of iterables with numeric elements.
- * @see NumericTraversableOps
- */
- implicit def numericTraversableWrapper[A](self: Traversable[A])(implicit num: Numeric[A]) =
- new NumericTraversableOps(self, num)
-
/** Implicit wrapper conversion of iterables with iterable elements.
* @see TraversableTraversableOps
*/