<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 21, 2012, at 3:18 PM, Roelof Wobben wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<div bgcolor="#FFFFFF" text="#000000">
Op 21-2-2012 20:51, Stephen Bloch schreef:
<blockquote cite="mid:C462650F-784E-463B-B671-61FF7B1BCDC9@adelphi.edu" type="cite">
<pre wrap="">On Feb 21, 2012, at 2:43 PM, Roelof Wobben wrote:
</pre>
<blockquote type="cite">
<pre wrap="">But now I get this error message :
unsaved editor>:27:23: function call: expected a function after the open parenthesis, but found a part in: (tarief1 amount)
When I do (tarief 1 amount) instead of ((tarief amount))
</pre>
</blockquote>
<pre wrap="">Yes, that's where the syntax error is. So you've fixed that.</pre>
</blockquote>
<br>
I fixed that? I always thought that if I use another function that
I must be into ().<br>
So In my opinion one () for the then part and one () for the
function call. <br></div></blockquote><div><br></div>No, there is no pair of parentheses for the "then" part, only one for the function call.</div><div><br></div><div>(cond [question answer]</div><div> [question answer]</div><div> ...</div><div> [question answer])</div><div>where each question and each answer is an expression (usually a function call).</div><div><br><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000"><blockquote cite="mid:C462650F-784E-463B-B671-61FF7B1BCDC9@adelphi.edu" type="cite"><pre wrap="">1) Have you written a complete set of test cases, with right answers, using "check-expect"? Since there are four categories of input for this problem, you need at least four test cases, and you should probably have three more for the boundaries, a total of seven test cases.
</pre>
</blockquote>
<br>
Nope, check-expect is not explained on chapter section 3 of the book
how to design programms. So I did not use that function. I can make
test-cases but then in this form <br>
<br>
(<span class="builtin">=</span> (<i>tarief 495</i><span class="selfeval"></span>) 1,2375) <br></div></blockquote><div><br></div>That should work too, although it's not as convenient. Make sure you put a bunch of those test cases in the Definitions pane, after the definition:</div><div><br></div><div>(define (tarief blah blah)</div><div> blah blah blah</div><div> )</div><div><br></div><div>(= (tarief 495) 1,2375)</div><div>(= (tarief 0) 0)</div><div>(= (tarief 100) whatever)</div><div>...</div><div><br></div><div>That will also solve the next problem:</div><div><br></div><div><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000">3) Have you used the Stepper to watch what your program is doing?
<br>
<br>
Yes, when I do (payback 2600) on the prompt and press Step I only
see a message All definitions have been sucessfully evaluated and
not other outcome so that did not help me any further. <br></div></blockquote></div><br><div>The Stepper only works on expressions in the Definitions pane, not the Interactions pane. If you put your test cases in the Definitions pane as described above, the Stepper will help you find where things are going wrong.</div><div><br></div><div>BTW, check-expect is not discussed in _How to Design Programs_ because it hadn't been invented yet when the book was written. It's quite easy to use, though: replace the = sign in the above tests with check-expect, and when you hit "Run" you'll get a report of which of your test cases worked, the expected answer and the actual answer.</div><div><br></div><div>You might consider working through the Second Edition of _How to Design Programs_ instead; see <a href="http://www.ccs.neu.edu/home/matthias/HtDP2e/">http://www.ccs.neu.edu/home/matthias/HtDP2e/</a> .</div><div><br></div><br><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>