Lisp program that creates a ternary tree from a list