I got stuck with this assignment in Scheme. To be honest, I have no idea about it. Could anyone give me ideas for this coding assignment?
Create a function that given a "list", returns a copy with all instances of "old" substituted by "new", including in nested lists.
HINT: You will need to use recursion,
carandcdr. You may also want to use the following predicates:
pair?---Identifies if something is a pair. Recall that all lists are built from pairs.equal?---Does standard equality testing. Note that=only works for numbers, unlikeequal?.null?---Tests if something is null. Recall that lists are nil/null terminated.
The code starts like this:
(define (subst new old list)
..... )