[Shootout-list] fibonacci and ackermann

Robert Seeger Robert Seeger <rhseeger@gmail.com>
Sun, 3 Apr 2005 14:17:48 -0500


Wouldn't something "Calculate the sum of the first N odd numbers,
recursively" avoid memoization? Ie:

proc Nsum {n} {
    expr { $n + [Nsum [incr n -1]] }
}

Any time you use a function with the same input more than once,
there's a chance for memoization. Why not just use a function that
uses each input only once.

Rob Seeger

On Apr 3, 2005 1:35 PM, Sebastien Loisel <sloisel@gmail.com> wrote:
> I personally prefer Ackermann because it is less likely to be memoized
> by a smartypants compiler. Purely functional, shmurely shmunctional.
> 
> On Apr 3, 2005 6:55 PM, Robert Seeger <rhseeger@gmail.com> wrote:
> > It occurred to me today that the Fibonacci and Ackermann tests are
> > testing the exact same thing. They both measure the speed of recursive
> > function performance, specifically with integers.
> >
> > Is there a reason that both tests need to exist? It seems to me that
> > the Fibonacci test measures everything that Ackermann does, while not
> > having the liability of running up against the recursion limit of some
> > languages (which, it is my understanding, is not something the
> > Shootout is designed to test).
> >
> > Rob Seeger
> >
> > _______________________________________________
> > Shootout-list mailing list
> > Shootout-list@lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/shootout-list
> >
>