This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Method to subtract a List from another

1 reply
Amit Dev
Joined: 2009-03-03,
User offline. Last seen 42 years 45 weeks ago.
I'm trying scala after a long time, so this may be an easy question:

$ scala
Welcome to Scala version 2.7.0-final (Java HotSpot(TM) Client VM, Java 1.6.0_07)
.
Type in expressions to have them evaluated.
Type :help for more information.

scala> List(1,2,3,4)
res0: List[Int] = List(1, 2, 3, 4)

scala> List(2,3)
res1: List[Int] = List(2, 3)

scala> res0 -- res1
<console>:7: error: value -- is not a member of List[Int]
       res0 -- res1
            ^


Regards,
aMit
Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Method to subtract a List from another
This works on newer versions of Scala.

2009/3/3 Amit Dev <amitdev@gmail.com>
I'm trying scala after a long time, so this may be an easy question:

$ scala
Welcome to Scala version 2.7.0-final (Java HotSpot(TM) Client VM, Java 1.6.0_07)
.
Type in expressions to have them evaluated.
Type :help for more information.

scala> List(1,2,3,4)
res0: List[Int] = List(1, 2, 3, 4)

scala> List(2,3)
res1: List[Int] = List(2, 3)

scala> res0 -- res1
<console>:7: error: value -- is not a member of List[Int]
       res0 -- res1
            ^


Regards,
aMit

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland