# HG changeset patch # User wenzelm # Date 1472826182 -7200 # Node ID d1a5d10affc05d20958eb4f81f80ac5664be6a26 # Parent 4ad836f0b146528274a48099724ea016b9426923 simplified; diff -r 4ad836f0b146 -r d1a5d10affc0 src/Pure/library.scala --- a/src/Pure/library.scala Fri Sep 02 12:29:06 2016 +0200 +++ b/src/Pure/library.scala Fri Sep 02 16:23:02 2016 +0200 @@ -188,10 +188,10 @@ def remove[A, B](x: B)(xs: List[A]): List[A] = if (member(xs)(x)) xs.filterNot(_ == x) else xs def update[A](x: A)(xs: List[A]): List[A] = x :: remove(x)(xs) - def distinct[A](xs: List[A], eq: (A, A) => Boolean = (x: A, y: A) => x == y): List[A] = + def distinct[A](xs: List[A]): List[A] = { val result = new mutable.ListBuffer[A] - for (x <- xs if !result.exists(y => eq(x, y))) result += x + xs.foreach(x => if (!result.contains(x)) result += x) result.toList } }