POV-Ray : Newsgroups : povray.off-topic : A comparison : Re: A comparison Server Time
10 Oct 2024 17:18:11 EDT (-0400)
  Re: A comparison  
From: Invisible
Date: 19 Mar 2008 05:05:04
Message: <47e0e550$1@news.povray.org>
scott wrote:

>> 2. The second version is very much shorter. (And simpler?)
> 
> You made it simpler, I can make the first one simpler too :-)

I was thinking in terms of how you would literally write the source code 
in imperative and functional languages.

   var total = 0;
   var position = list.start();
   while (position != null)
   {
     total = total + position.get_value();
     position = position.get_next();
   }

Pretty much a verbatim match there.

>> 3. The second version looks like some kind of a riddle. Not a hard 
>> riddle, but a somewhat baffling definition all the same.
> 
> And seems unnecessarily complex.  Why bother going through splitting 
> lists and passing them to recursive functions, when all you really need 
> to do is loop through all entries and add up the numbers?

And of course, accessing parts of a list requires splitting them, and 
recusion isn't looping. ;-)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.