Skip to content

Instantly share code, notes, and snippets.

@davidandrzej
Created July 17, 2012 00:53
Show Gist options
  • Select an option

  • Save davidandrzej/3126218 to your computer and use it in GitHub Desktop.

Select an option

Save davidandrzej/3126218 to your computer and use it in GitHub Desktop.
Map over a Strict Range
scala> val mutant = collection.mutable.ListBuffer[Int]()
mutant: scala.collection.mutable.ListBuffer[Int] = ListBuffer()
scala> (0 until 4).map{idx => {
mutant.append(idx); idx > 0}}.exists(identity)
res0: Boolean = true
scala> mutant
res1: scala.collection.mutable.ListBuffer[Int] =
ListBuffer(0, 1, 2, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment