Question: Must be Written in Scala PLEASE Write a recursive procedure that returns true if the list has the Fibonacci property. Le, every element at position

Must be Written in Scala PLEASEMust be Written in Scala PLEASE Write a recursive procedure that returns

Write a recursive procedure that returns true if the list has the Fibonacci property. Le, every element at position i 2 2 is the sum of the two preceding elements Note that the property is trivially true for lists of sizes 0 and 1. def sFibonacciList (1st : NunList): Boolean : { YOUR CODE HERE val 11 = Cons(12, Cons(25, Cons(37, Nil))) assert(isFibonaccilist (11), Test case 1:isFibonaccilist (11)should return true" val 12Cons (14, Cons(-1, Cons(13, 11 ) assert (isFibonaccilist(12), "Test case 2 : stibonacciList (12) -- should return true" val 13 = Cons(7, Cons(7, 12)) assert(!isFibonaccilist(13), "Test case 3 : sFibonacciList(13) -- should return false") | val 14-Cons(0, Cons(0, Cons(0, Cons(0, Cons(0, Cons(0, Nil)))))) assert(isFibonaccilist(12), Test case 4: isFibonaccilist(14)should return true passed(7) Write a recursive procedure that returns true if the list has the Fibonacci property. Le, every element at position i 2 2 is the sum of the two preceding elements Note that the property is trivially true for lists of sizes 0 and 1. def sFibonacciList (1st : NunList): Boolean : { YOUR CODE HERE val 11 = Cons(12, Cons(25, Cons(37, Nil))) assert(isFibonaccilist (11), Test case 1:isFibonaccilist (11)should return true" val 12Cons (14, Cons(-1, Cons(13, 11 ) assert (isFibonaccilist(12), "Test case 2 : stibonacciList (12) -- should return true" val 13 = Cons(7, Cons(7, 12)) assert(!isFibonaccilist(13), "Test case 3 : sFibonacciList(13) -- should return false") | val 14-Cons(0, Cons(0, Cons(0, Cons(0, Cons(0, Cons(0, Nil)))))) assert(isFibonaccilist(12), Test case 4: isFibonaccilist(14)should return true passed(7)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!