<html><head><base href="x-msg://21/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 25, 2012, at 9:08 PM, Ashley Fowler wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-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: 0px; font-size: medium; "><div fpstyle="1" ocsi="0"><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; "><div>so far I have&nbsp;</div><div><br></div><div><div>(define getNth (lambda (N LS)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(if (eq? N 0)(car LS)</div></div><div><br></div><div>which only includes the "base case".</div></div></div></span></blockquote><div><br></div>And even with only the base case written, there's already a bug that will cause it to crash horribly.</div><div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-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: 0px; font-size: medium; "><div fpstyle="1" ocsi="0"><div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt; "><div> I need help on how to create this function. Any ideas?</div></div></div></span></blockquote><br></div><div>No, you don't need help on how to create THIS function; you need help on how to create functions. &nbsp;You've got several test cases with correct answers, which is one important step in the right direction (although I would also add a test case with an empty list). &nbsp;The next (or perhaps previous!) step should be to really understand the data types of your inputs: a whole number and a list. &nbsp;Both of these are recursively-defined data types, so you need to look at&nbsp;<a href="http://picturingprograms.com/download/chap25.pdf">http://picturingprograms.com/download/chap25.pdf</a> , which is entitled "Multiple recursive data". &nbsp;Of course, that chapter assumes that you're already fluent at writing functions that operate on ONE recursive data type, e.g.&nbsp;<a href="http://picturingprograms.com/download/chap22.pdf">http://picturingprograms.com/download/chap22.pdf</a> and&nbsp;<a href="http://picturingprograms.com/download/chap24.pdf">http://picturingprograms.com/download/chap24.pdf</a> .</div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; 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: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; 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: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Stephen Bloch</div><div><a href="mailto:sbloch@adelphi.edu">sbloch@adelphi.edu</a></div></div></span></span>
</div>
<br></body></html>