|
Scala example source code file (takeAndDrop.scala)
The Scala takeAndDrop.scala source codeobject Test { def main(args: Array[String]): Unit = { val range = 1 to 10 val target = (3 to 8).toList val confirm = (xs: Seq[Int]) => assert(xs.toList == target, xs) confirm(range drop 2 dropRight 2) confirm(range drop 1 dropRight 1 drop 1 dropRight 1) confirm(range take 8 drop 2) confirm(range takeRight 8 dropRight 2) confirm(range drop 2 take 6) confirm(range dropRight 1 take 8 takeRight 7 drop 1) } } Other Scala examples (source code examples)Here is a short list of links related to this Scala takeAndDrop.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.