<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Aug 5, 2014 at 5:06 PM, Jens Axel Søgaard <span dir="ltr"><<a href="mailto:jensaxel@soegaard.net" target="_blank">jensaxel@soegaard.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">What happens in create-bst-word, when the word to inserted is the same<br>
as (node-word bst) ?</blockquote><div><br></div><div>Aha! I see. It returns void because there is no case for when the string is equal. </div><div><br></div><div><div>> (void? (create-bst-word (create-bst-word false "dan") "dan"))</div>
<div>#t</div></div><div><br></div><div>I patched it with an else-case now.</div><div><br></div><div><div>(define (create-bst-word bst str)</div><div> (cond</div><div> ((false? bst)</div><div> (make-node str false false))</div>
<div> ((string<? str (node-word bst)) ;; insert at the left</div><div> (make-node (node-word bst)</div><div> (create-bst-word (node-left bst) str)</div><div> (node-right bst)))</div><div>
((string>? str (node-word bst)) ;; insert at the right</div><div> (make-node (node-word bst)</div><div> (node-left bst)</div><div> (create-bst-word (node-right bst) str)))</div><div> (else (make-node (node-word bst)</div>
<div> (node-left bst)</div><div> (node-right bst)))))</div></div><div><br></div><div><div>> (void? (create-bst-word (create-bst-word false "dan") "dan"))</div>
<div>
#f</div></div><div><br></div><div>Thank you.</div></div></div></div>