POV-Ray : Newsgroups : povray.off-topic : More Haskell fanning : Re: More Haskell fanning Server Time
30 Jul 2024 02:27:51 EDT (-0400)
  Re: More Haskell fanning  
From: Darren New
Date: 14 May 2011 12:17:14
Message: <4dceab0a$1@news.povray.org>
On 5/14/2011 0:53, Warp wrote:
> Invisible<voi### [at] devnull>  wrote:
>> 1. Writing
>
>>     Iterator<Foo>  it = list1.iterator();
>>     ArrayList<Foo>  list2 = new ArrayList<Foo>();
>>     while (it.hasNext()) list2.add(bar(it.next()));
>
>> is way more work than writing
>
>>     list2 = map bar list1
>
>    Argument from verbosity is seldom a good argument in programming.
> Just because something is shorter doesn't necessarily mean it's better.

I would say in this case it is, because all the extra stuff is just 
verbiage. It obscures the algorithm you're actually interested in, which is 
to make a new list where each element is the old list with 'bar' applied to 
it. All the stuff with the iterator and the types and all is just junk you 
have to repeat wherever you need to do this.
-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

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