According to page 44 of Scala's Programming book, there is a remove function for the list data structure. However, when I try to give an example in my interpreter, I keep getting errors. Does anyone know why? Here is an example
scala> val x = List(1,2,3,4,5,6,7,8,9) x: List[Int] = List(1, 2, 3, 4, 5, 6, 7, 8, 9) scala> x.remove(_ < 5) <console>:9: error: value remove is not a member of List[Int] x.remove(_ < 5) ^ scala> x.remove(s => s == 5) <console>:9: error: value remove is not a member of List[Int] x.remove(s => s == 5) ^ scala> val y = List("apple","Oranges","pine","sol") y: List[String] = List(apple, Oranges, pine, sol) scala> y.remove(s => s.length ==4) <console>:9: error: value remove is not a member of List[String] y.remove(s => s.length ==4)
source share