Question: Consider the following code: function mkstream ( k; number ) { let s = sempty ( ) ; function rec ( i: number ) :

Consider the following code:
function mkstream(k; number){ let s = sempty(); function rec(i: number): Stream { return i < k ? snode(i,()=> rec(i+1)) : s; } return s = rec(0); } function count(n: number, k: number){ for (let s = sempty(); --n >=0; s = s.tail()) if (s.isEmpty()) s = mkstream(k); } count(188,2);
How many nodes are created with snode()?

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 Programming Questions!