I'm attempting to create a function that inserts a value into a binary search tree. The conditions within the function seem to work correctly, but I'm not quite sure how to actually insert the value once I reach the null point in the list where it should go.
bst-element refers to another function I have checking if the value already exists in the tree, since the tree should have no duplicates.
(define (bst-insert item bst-tree)
(cond ((bst-element? item bst-tree)bst-tree)
((null? bst-tree) ??? )
((< item (bst-value bst-tree))(bst-insert item (bst-left bst-tree)))
((> item (bst-value bst-tree))(bst-insert item (bst-right bst-tree)))))