You cannot prevent the dog from eating your program. But you can keep a backup. A computer scientist always keeps a backup.
Copy your files to a flash drive, and to your CS Linux account. CS backs up your Linux files every 4 hours, under .snapshot/
and get the recursive case(s) right,
your function is right.
the one that heralds new discoveries,
is not "Eureka" but "That's funny ... "
-- Isaac Asimov (1920 - 1992)
public static boolean debugflag = true; Cons solve(Cons e, String v) { if (debugflag) System.out.println("entering solve" + " e = " + e + " v = " + v); ... if (debugflag) System.out.println("leaving solve" + " val = " + val); return val; }
public static boolean debugflag = false;but if you later encounter a bug, you can easily turn the printouts back on.
Don't focus on "How can I get the right answer to the hard test case?", but on "How can I find a small test case that demonstrates a small problem that I can fix?".
Printouts will make an infinite loop very obvious.
double sum;then you may get a NaN. NaN is contagious:
trash = sum + 1.0;will be a NaN if sum is a NaN.
((the sum of) a and b)is the result of:
(cons '(the sum of) '(a and b))when what you probably wanted was:
(append '(the sum of) '(a and b))which produces:
(the sum of a and b)cons, list, and append all have their uses; learn when to use each.
llmergesort(lst);and some of your data is gone. Did the dog eat your data? No; since llmergesort is destructive, you must re-assign the value:
lst = llmergesort(lst);See the slide entitled On Not Dropping the Ball.