The difficulty with this competition was always going to be that the quest was to find ".. the most elegant ..." - i.e. a subjective evaluation criterion.

So I thought about what would Mark W. find elegant - and decided I had to use (or over-use) variable declarations.

First, I had a version that started out ...

function fib p
  local f
  local i
  local b
  local o
  local n
  local a
etc.

But this ran into a problem with the second " local c" because that was the same variabledeclared twice - surely not elegant.

Second, I tried it doing

  local i
...
  local c
  global c
  global i

but this causes errors ("variable shadows another") when I turned on strict compilation (which had to be a part og any answer that would meet Mark's satisfaction).

Then I realized this was the wrong approach - what I needed to do was use the more expansive form of declaration, and then simply let Rev find me the correct definition of the function.

universal fibonacci -- somewhere in the univese this function must already exist
and then I should be able to just call it, and let Rev find it and use it. :-)

So - I claim the shortest solution (either 1 line or 0 lines, depending how you count); unfortunately I can't verify the results until version 5 or 6 of Rev, which will include the complete implementation of code sharing to allow finding universal handlers and variables.

-- Alex.


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to