Assume that we have the following LazyList definition:
val fibs: LazyList[BigInt] = BigInt(0) #:: BigInt(1) #::
fibs.zip(fibs.tail).map(pair => pair._1 + pair._2)
My question is how is that executed, because this definition says that we take the tail and we do computation for each pair (from the zip). But if we want to calculate element with index 10 we already have values for ...8, 9. So the question is... is this somehow optimized, or for each next element we go through all the pairs?