0
我從這個page嘗試的例子雖然我試圖創造一個後序遍歷看到例如前序遍歷的,列表不接受特殊字符在結束
(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)))))
我越來越(((2) (3) . +) ((7) (8) . -) . *)
但我慾望'(2 3 + 7 8 - *)。當我嘗試使用append
時,它會顯示「APPEND:正確的列表不能以結尾」錯誤。如果預先附加任何 +, - ,/ etc的罰款,但最後爲什麼它會抱怨?
我需要幫助解決這個問題。
請確保您的代碼正確縮進和格式化。 –
@RainerJoswig:我對lisp沒有太多的經驗,我會在將來的文章中注意到這一點。謝謝。 – Rorschach