Consider the following definition of the function subst:

1.  var subst = function (n,o,t) {
2.     if (fp.isNull(t)) {
3.         return t;
4.     } else if (fp.isList(fp.hd(t))) {
5.         return fp.cons(subst(n,o,fp.hd(t)),subst(n,o,fp.tl(t)));
6.     } else if (fp.isEq(o,fp.hd(t))) {
7.         return fp.cons(n,subst(n,o,fp.tl(t)));
8.     } else {
9.         return fp.cons(fp.hd(t),subst(n,o,fp.tl(t)));
10.    }
11. };

Suppose that you want a function that inserts its first argument after each occurrence of its second argument in its third argument, where that third argument must be a list. This could be accomplished by making a small change in the same line you identified in the previous problem. Now, assume that you have made that change to that line of the subst function. What further change would you have to perform to go from the "insert before" behavior to the "insert after" behavior?

Swap the first arguments of two fp.cons calls.
  1. Swap an fp.cons with an fp.hd.
  2. Swap an fp.cons with an fp.tl.
  3. Swap the first arguments of two fp.cons calls.
  4. None of the other options.

Make sure you understand what the new function is supposed to compute and how it differs from both the subst function above and the function that you wrote for the previous problem.

You may have to solve the previous problem again, which was to insert the first argument before each occurrence of the second argument in the third argument, where that third argument must be a list.