<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>To find out what is going on, make a function like same-parity that simply returns the dotted x. Then, try it in the interactions window to see what the function gets for x. Use arguments that are like the ones you expect to be created in same-parity.</div><div><br></div><div>rac</div><br><div><div>On Feb 6, 2009, at 4:46 PM, Lisa Gandy wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Courier; font-size: 14px; 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 class="hmmessage" style="font-size: 10pt; font-family: Verdana; "><a href="mailto:plt-scheme@list.cs.brown.edu">Hi,</a><br>I have the following code..<br><br>(define (same-parity p . x)<br> (define ind (remainder p 2))<br> (cond ((null? x) '())<br> ((= ind (remainder (car x) 2))<br> (cons (car x) (same-parity p (cdr x))))<br> (else (same-parity p (cdr x)))))<br><br>I thought that x would be passed in as a list however<br>when I run this function I get...<br>(require (lib "trace.ss"))<br>> (trace same-parity)<br>> (same-parity 1 2 3 4 5)<br>|(same-parity 1 2 3 4 5)<br>|(same-parity 1 (3 4 5))<br><br>What is going on here?<br><br>Thanks!<br>_________________________________________________<br> For list-related administrative tasks:<br> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br></div></span></blockquote></div><br></body></html>