Consider the following definition of the function subst:

var subst = function (n,o,ns) {
    if (fp.isNull(ns)) {
        return [ ];
    } else if (fp.isEq(o,fp.hd(ns))) {
        return fp.cons(n,subst(n,o,fp.tl(ns)));
    } else {
        return fp.cons(fp.hd(ns),subst(n,o,fp.tl(ns)));
    }
}

Suppose that you want to make this function perform a "deep substitution" at all levels of a (generalized) list. For example:

> subst( 2, 3, [3, 9, [4, 2, 3], 3, 5] ) 
[ 2, 9, [ 4, 2, 2 ], 2, 5 ]

Which one of the following statements best characterizes how this could be done?

You must add at least one additional else-if, with two recursive calls to subst.
  • You must add at least one additional else-if, with one recursive call to subst.
  • You must add at least two additional else-ifs, each with one recursive call to subst.

Remember that, on an exam or if called upon in class, you will have to fully develop the code for this function.