equal
deleted
inserted
replaced
276 val res = new mutable.ListBuffer[A] |
276 val res = new mutable.ListBuffer[A] |
277 (1 to n).foreach(_ => res += a) |
277 (1 to n).foreach(_ => res += a) |
278 res.toList |
278 res.toList |
279 } |
279 } |
280 |
280 |
281 def the_single[A](xs: List[A]): A = |
281 def the_single[A](xs: List[A], message: => String = "Single argument expected"): A = |
282 xs match { |
282 xs match { |
283 case List(x) => x |
283 case List(x) => x |
284 case _ => error("Single argument expected") |
284 case _ => error(message) |
285 } |
285 } |
286 |
286 |
287 def symmetric_difference[A](xs: List[A], ys: List[A]): (List[A], List[A]) = |
287 def symmetric_difference[A](xs: List[A], ys: List[A]): (List[A], List[A]) = |
288 (xs.filterNot(ys.toSet), ys.filterNot(xs.toSet)) |
288 (xs.filterNot(ys.toSet), ys.filterNot(xs.toSet)) |
289 |
289 |