Write a procedure KeepFirst that will return the first n elements of a list.
It should be tail recursive. Tail recursion means that the final result
is returned when the "base case" is reached; no "backtracking" is needed.
An example of non-tail recursion is:
(defun length (ls)
(if (null ls)
0
(+ 1 (length (rest ls)))))
The above "length" function needs to backtrack for the result.
Tail recursive, non-backtracking version:
(defun length (ls &optional (result 0))
(if (null ls)
result
(length (rest ls) (+ 1 result))))
(See p. 75 "Recursion Can Be Efficient" and p. 83 "Optional Parameters")
Example of KeepFirst: (KeepFirst 5 '(a b c d e f g h)) returns (a b c d e)