Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the functions in one scheme file. Thanks in advance! For these problems, you must use pure functional scheme. That is You may not use
Write the functions in one scheme file. Thanks in advance!
For these problems, you must use pure functional scheme. That is You may not use a functions like set! whose name ends with'" .You may not use do. All repetition must be via explicit recursion or the recursion implicit in map or similar functions. .You may, however, use define - in fact you must use it. You may define additional helper functions Be sure to test your definitions using some implementation of the "R5RS" scheme standard, preferably the one in Racket - see Resources > Scheme > scheme-links.html for a discussion of how to get it. (It is what I have been using in lecture.) If you use the Racket implementation of scheme, be sure that the language is set to R5RS the name "R5RS" should appear at the bottom left corner of the window, and not something like "advanced student" or "Determine language from source 1. Define (i.e. write) the function (echo lst). This function doubles each top-level element of list lst. E.g., (echo '(a b c)) returns (aabbcc). (echo '(a (b c))) returns (a a (b c) (b c)) 2. Define the function (echo-lots lst n). (echo-lots '(a (b c)) 3) returns (aa a (b c) (b c) (b c)), that is, it is like echo but it repeats each element of lst n times 3. Define the function (echo-all Ist) which is a deep version of echo. (echo-all '(a (b c)) should return (a a (b bcc)(b b c c) 4. Define the function nth. (nth i lst) returns the ith element of lst. E.g., (nth 0 '(a b c)) returns a, and (nth 1 '(a (b c) d) returns (b c). You may assume that 0siStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started