summaryrefslogtreecommitdiff
path: root/test/files/run/matchonseq.scala
diff options
context:
space:
mode:
authorJosh Suereth <joshua.suereth@gmail.com>2012-03-16 20:59:38 -0400
committerJosh Suereth <joshua.suereth@gmail.com>2012-03-16 20:59:38 -0400
commitb3efb3d493605d1c7e106e5f0a697b52ebb3d97c (patch)
tree1a141a2b741684b91d56c1288ab043623f2ce956 /test/files/run/matchonseq.scala
parentd267988ddbf03c71fa1ef2fa51f2d218793632ed (diff)
downloadscala-b3efb3d493605d1c7e106e5f0a697b52ebb3d97c.tar.gz
scala-b3efb3d493605d1c7e106e5f0a697b52ebb3d97c.tar.bz2
scala-b3efb3d493605d1c7e106e5f0a697b52ebb3d97c.zip
Added +: and :+ extractors to mirror append/prepend.
* +: does head/tail decomposition on any Seq * :+ does init/last decomposition on any Seq * Both preserve specific Seq types. Review by @odersky
Diffstat (limited to 'test/files/run/matchonseq.scala')
-rw-r--r--test/files/run/matchonseq.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/files/run/matchonseq.scala b/test/files/run/matchonseq.scala
new file mode 100644
index 0000000000..49b406a6ec
--- /dev/null
+++ b/test/files/run/matchonseq.scala
@@ -0,0 +1,8 @@
+object Test extends App{
+ Vector(1,2,3) match {
+ case head +: tail => println("It worked! head=" + head)
+ }
+ Vector(1,2,3) match {
+ case init :+ last => println("It worked! last=" + last)
+ }
+}