Question: Please use code.pyret.org/editor to finish this work. thanks! 3. Using just case analysis and recursion, define a function, called knil, that links a value of

Please use code.pyret.org/editor to finish this work. thanks!Please use code.pyret.org/editor to finish this work. thanks! 3. Using just case

3. Using just case analysis and recursion, define a function, called knil, that links a value of type T onto the *end* of a ListeT>. For example: knil(1, list: 3, 2]) should result in [list: 3, 2, 1]. HINT: Structure your program, as you presumably did previously in 1 and 2, as a case analysis on the input list l. Think recursively in the case when l is a link (f, r), with head or front element f and tail or rest r. What's a recursive way in which to move the new element "a" toward the end of the list, while maintaining the correct structure of the list up to that point? T, l:: List) ->ListeT: fun knil (a end check: knil(1, [list: 3, 2]) is [list: 3, 2,1] knil (0, [list: ]) is [1list: 0 knil (false, list: true, false]) is [list: true, false, false] end

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!