my ideas for array operations

Bill Baxter dnewsgroup at billbaxter.com
Sat Oct 6 00:35:49 PDT 2007


dennis luehring wrote:
>> void main()
>> {
>>     writefln( accum!("+",int)([1,2,3,4,5]) );
>>     writefln( accum!("*",int)([1,2,3,4,5]) );
>>     writefln( accum!("~",char[])(["D"," ","pro","gramming"]) );
>>
>> }
> 
> will u use these templates? why not?

I probably wouldn't use the functionality much at all, no matter what 
syntax it's wrapped up in.

Here's something you might like to read.
http://www.artima.com/weblogs/viewpost.jsp?thread=98196

As Guido puts it, aside from those few examples I gave above, there's 
really not that much use for that functionality.  And when it is needed 
for something other than those things it's often more readable to just 
write out the foreach.

--bb



More information about the Digitalmars-d mailing list