Consider the following definition of the function sumTree:

1. var sumTree = function (t) {
2.     if (fp.isNull(t)) {
3.         return 0;
4.     } else if (fp.isList(fp.hd(t))) {
5.         return fp.add(sumTree(fp.hd(t)),sumTree(fp.tl(t)));
6.     } else {
7.         return fp.add(fp.hd(t),sumTree(fp.tl(t)));
8.     }
9. };

Suppose that you want to develop a function that takes in an integer tree (represented, as usual, as a list of lists of . . . of integers, just like for the function sumTree above) and returns the total number of integers in the tree. Your goal is to implement this function by modifying the smallest number of lines in the function sumTree above. Which one of the following options characterizes the best solution to this problem?

Change line 7 only.
  • Change line 5 only.
  • Change lines 3 and 5 only.
  • Change lines 4 and 5 only.
  • Change lines 3, 5 and 7 only.
  • At least 4 lines must be changed.

Make sure you understand what the new function is supposed to compute and how it differs from the sumTree function.

Make sure that the new function considers all possible cases in the right order.

Remember to look for the solution with the minimum number of lines with code changes.