Problem 1) Write a Scheme function that takes two atoms and a list as parameters and returns a list identical to the parameter list except all top-level instances of the first given atom in the list are replaced with the second given atom. Please include checks on your input. Problem 2) Write a Scheme function that takes two atoms and a list as parameters and returns a list identical to the parameter list except all occurrences of the first given atom in the list are replaced with the second given atom, no matter how deeply the first atom is nested. What to submit Please submit your code. Also submit a paragraph explaining what your code does and why you believe it works. Finally submit screen shots from the execution of the code. It is enough to execute your functions on an online Scheme interpreter.
Problem 1)
Write a Scheme function that takes two atoms and a list as parameters and returns a list identical to the parameter list except all top-level instances of the first given atom in the list are replaced with the second given atom. Please include checks on your input.
Problem 2)
Write a Scheme function that takes two atoms and a list as parameters and returns a list identical to the parameter list except all occurrences of the first given atom in the list are replaced with the second given atom, no matter how deeply the first atom is nested.
What to submit
Please submit your code. Also submit a paragraph explaining what your code does and why you believe it works. Finally submit screen shots from the execution of the code. It is enough to execute your functions on an online Scheme interpreter.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images