[racket] Am I Missing Something? [HtDP 31.3.1]

From: Luke Jordan (luke.jordan at gmail.com)
Date: Tue Jan 4 09:38:36 EST 2011

All that code came straight out of the text, except that I used if instead
of cond.  The sum, accu-sum, and g-series defs are all given.  In your
results I see a difference.  When I run it at home it's the same.  I can
even (equal? (sum (listof number)) (accu-sum (listof number))) and get true.

On Tue, Jan 4, 2011 at 08:10, Carl Eastlund <cce at ccs.neu.edu> wrote:

> Luke,
> In the future, please do not post complete (or nearly complete)
> homework solutions to the list.  Try to find a slightly more indirect
> way to ask your question -- we're happy to answer, we just don't want
> copy/paste solutions floating around.  For now, though, here are the
> results I get with your code:
> Welcome to Racket v5.0.99.5.
> > (require "31.3.1.rkt")
> -0.4974659600326926
> -0.49746596003269405
> -4974659600326926.0
> -4974659600326941.0
> >
> Those look different to me.  Try subtracting one from the other to see
> how different.  Or, show us the results you get if you don't get the
> same results.
> Carl Eastlund
> On Mon, Jan 3, 2011 at 10:48 PM, Luke Jordan <luke.jordan at gmail.com>
> wrote:
> > When I run the plain recursive vs. the accumulator version of sum with
> > g-series, I get the same result, which the text says isn't supposed to
> > happen.  Code attached.  What am I missing?
> > Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110104/e94ab529/attachment.html>

Posted on the users mailing list.