if-expressions

Daniel Keep daniel.keep.lists at gmail.com
Mon May 28 20:09:08 PDT 2007



Jarrett Billingsley wrote:
> "Daniel Keep" <daniel.keep.lists at gmail.com> wrote in message 
> news:f3g2kl$2tj7$1 at digitalmars.com...
>> In any case, it's something I'd definitely like to see in D.  Hell, I'd
>> also like to see this:
>>
>> double[] as = [1.,2.,3.,4.,5.];
>> double[] bs = foreach(a;as) a*a;
> 
> That looks like it could be done with array operations (defined, but not 
> implemented):
> 
> double[] as = [1, 2, 3, 4, 5];
> double[] bs = as[] * as[]; // or maybe as * as 

Well, in a way, this is an explicit form of array ops with the advantage
that it would work for any type with opApply :)

-- 
int getRandomNumber()
{
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

http://xkcd.com/

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/



More information about the Digitalmars-d mailing list