But we obtain NIL and if I call nums it returns only #<5> but not a TREE as book explains…

But ther’re many steps that are obscure for me:For example the function never create an istance of node structure…infact “(make-node :elt obj)” set a value for elt slot but not create an instance of node!!…then in “else” conditions how function can call: (let ((elt (node-elt bst)))”..?????bst isn’ t an instance of node!!!it’s like :(let((elt (node-elt #<5>…) that raise error!!…for me it’s obscure code, can someone help me with??Thanks in advance

Everything is fine in the code, you're just confused by what the call to a struct returns.When you eval nums at the repl, the :print-function defined by defstruct is called and returnsa string of the form #<5>, where 5 is the element stored in the main node of your tree.

Graham returns a string of the form #<...> precisely because it is an error to evaluate a formstarting by #< at the repl. The printed form of num is not a tree object but just an indicationof what is in the main node of the tree, not meant for consumption at the repl.

You can however call the three functions defined by defstruct, namely node-elt, node-r and node-l,on a given node structure, to access the datas stored in the three slots of the struct (for nums, the number 5, and two other node structures) and print recursivelythe elements stored in the tree.

(node-elt nums) => 5 ;; 5 is stored in the first node of the tree(node-l nums) => #<4> ;; the left slot of nums contains the number 4(node-r nums) => #<8> ;; the right slot of nums contains the number 8(node-l (node-l nums)) => #<2> ;; we get the printed form of the left node of the left node of nums

hooo, perfect stackman!!now it's all clear...thanks very much!!!my problem was also in "visualization" the correct structure of a binary tree...well, for example after five iterations "nums" become a sequence of nested lists like this: (5, (4,(2,1,NIL) NIL) 8)...where first item in list is a node, second left child and third right child),;then the bst-insert recursive function create a new istance of node structure with make-node --> sub-nodes of root relatively to a given "ordering function" ( < in this example) ;finally I hope you understand it !!!!!

ps. I'm following "Ansi CL" as guide book... You think that "Land of Lisp" can be a better choise for a beginner like me??..if yes I can also buy it;but so far with "ANSI CL" all seems ok, the synthax seem quite simple...but with semantic I have some problems (as in this case) becouse Graham seems very coincide and my english is very poor and probably I'm not so much deft!!