Skip to content

Instantly share code, notes, and snippets.

@invkrh
Last active September 7, 2015 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invkrh/b41770ecf8bea429f442 to your computer and use it in GitHub Desktop.
Save invkrh/b41770ecf8bea429f442 to your computer and use it in GitHub Desktop.
scala> List(1,2,3,4,5) map {x => println("x"); x} map {y => println("y"); y}
x
x
x
x
x
y
y
y
y
y
res0: List[Int] = List(1, 2, 3, 4, 5)
scala> val a = List(1,2,3,4,5).view map {x => println("x"); x} map {y => println("y"); y}
a: scala.collection.SeqView[Int,Seq[_]] = SeqViewMM(...)
scala> a(3)
x
y
res1: Int = 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment