<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<br><div><div>On Oct 7, 2012, at 10:03 PM, Ashley Fowler wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"> <div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">I need help with making a function that deletes the nth term from a list.(<span style="white-space: pre-wrap; ">list LS with its Nth element (with indexes </span><span style="white-space: pre-wrap; ">starting at 0) deleted)</span> <div>So far I have&nbsp;</div> <div><br> </div> <div> <div>(define (deleteNth N ls)</div> <div>&nbsp; &nbsp; (if (null? ls)</div> <div>&nbsp; &nbsp; &nbsp; &nbsp; ls</div> <div>&nbsp; &nbsp; &nbsp; &nbsp; (deleteNth (- N 1) (cdr ls))))</div> </div> <div><br> </div> <div>The results should be ...</div> <div><br> </div> <div> <pre style="word-wrap: break-word; white-space: pre-wrap; ">(deleteNth 4 '()) returns ()
(deleteNth 0 '(a b c)) returns (b c)
(deleteNth 3 '(a b c)) returns (a b c)</pre> </div> </div></blockquote><br></div><div>Once again, notice that both of your arguments are of recursively-defined types (a whole number and a list, respectively), so you need to look at Chapter 25 of _Picturing Programs_ (<a href="http://picturingprograms.com/download/chap25.pdf">http://picturingprograms.com/download/chap25.pdf</a>), or Chapter 17 of _How to Design Programs_ (<a href="http://htdp.org/2003-09-26/Book/curriculum-Z-H-22.html#node_chap_17">http://htdp.org/2003-09-26/Book/curriculum-Z-H-22.html#node_chap_17</a>).</div><br><div> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div>Dr. Stephen Bloch</div><div>Math/CS Department</div><div>Adelphi University</div><div><a href="mailto:sbloch@adelphi.edu">sbloch@adelphi.edu</a></div><div><br class="webkit-block-placeholder"></div></span><br class="Apple-interchange-newline"> </div><br></body></html>