Defining Pet Features and Essentials

Geoff Canyon gcanyon at gmail.com
Thu Feb 13 00:20:32 EST 2014


On Wed, Feb 12, 2014 at 10:41 PM, Mark Wieder <mwieder at ahsoftware.net>wrote:

> Close. Your first array element is empty. Right answer, though.
>

What's in the array isn't important, really -- it's just a manual form of
the memo feature some languages offer. fibArray[1] is empty, as is
fibArray[0], because the function short-cuts both of those arguments and
simply returns them. I literally went online and searched "recursive
fibonacci function" and copy-pasted, then added the memo feature. I think
it's more honest to do that, since the exact function isn't really the
point.

In a sense, applying memo might be considered a cheat, since the point was
that LC performance could be improved. Finding a clever way to patch over
LC's lack of tail-recursion optimization or memo isn't really the point,
but I thought it was valid here to mention that the thing that (I assume)
makes javascript faster than LC might be built-in on the JS side, but can
be replicated pretty simply on the LC side.



More information about the use-livecode mailing list