How to simplify this Scala Fibonacci code, which returns the sixth digit? -
The purpose of the application is to display a number sequence and the user has to select the sixth digit: 1 2 3 5 8 ... However, to check the application's demands, another code was to be created, i.e. the sixth digit number of the sequence. Test Import org.scalatest.FunSuite Import org.scalatest.FunSpec Import org.scalatest.matchers.ShouldMatchers Class Calculation Test FenSuit {Test ("fibonacci") {emphasis (calculation. Fibonacci (1, 2) === 13)}} main object calculation {EFFibonaceae (A: IIT, B: IT): IT = {vir first: int = one var second: IT = b preferred third: int = 0 second fourth: int = 0 fifth: int = 0 viral sixth: int = 0 third = first + second fourth = second + it Ra = Fifth Third + Fourth sixth = fourth + fifth comeback sixth}} What The main code is possible to simplify, eg. Just doing the return of the sixth digit, instead of comparing each individual issue? You can define the sequence as infinite laziness Will not: Scala...