Defining Pet Features and Essentials

Geoff Canyon gcanyon at gmail.com
Thu Feb 13 00:01:56 EST 2014


On Wed, Feb 12, 2014 at 9:48 PM, Geoff Canyon <gcanyon at gmail.com> wrote:

> 3524578 0.000022
>

Ha, let me not cheat:

on mouseUp
   clearFib
   put the long seconds into T
   get fib(33)
   put it && the long seconds - T
end mouseUp

local fibArray

function fib N
   if N = 0 or N = 1 then return N
   if fibArray[N] is empty then put fib(N-1) + fib(N-2) into fibArray[N]
   return fibArray[N]
end fib

on clearFib
   delete variable fibArray
end clearFib

Puts:

3524578 0.000357

Not *as* fast as the original, but still very fast.



More information about the use-livecode mailing list