Question: I. Write a scheme macro (firstNon0 ), which evaluates the one by one until one of them evaluates to a non-0 value. As soon as

I. Write a scheme macro (firstNon0 ), which evaluates the one by one until one of them evaluates to a non-0 value. As soon as it finds an which evaluates to a non-zero value, firstNon0 stops and returns that value. If all of the s evaluate to 0, firstNon0 should return 0. If you prefer, your macro can take more than three s

II. Write a scheme function (tribonacci n). The tribonacci numbers Ti are defined as T0 = T1 = 0, T2 = 1, and TN = TN-1 + TN-2 + TN-3. (tribonacci n) should return Tn

IV. Write a definition in Prolog for the predicate trib(N, T) which is true if T is the Nth tribonacci number, as defined above.

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!