I am trying examples from this page While I am trying to create a post-order traversal seeing example of pre-order traversal,
(defun bin-tree-postorder (B)
"Create a list containing keys of B in preorder."
(if (bin-tree-leaf-p B)
(list (bin-tree-leaf-element B))
(let ((elmt (bin-tree-node-element B))
(left (bin-tree-node-left B))
(right (bin-tree-node-right B)))
(cons (bin-tree-postorder left)
(cons (bin-tree-postorder right) elmt)))))
I am getting (((2) (3) . +) ((7) (8) . -) . *)
But I desire '(2 3 + 7 8 - *). When I try to use append
it says " APPEND: A proper list must not end with" error. In case of prepend its fine to append any
+, -, / etc but at the end why is it complaining ?
I need help on fixing this.