Exponential operator

language_fan foo at bar.com.invalid
Fri Aug 7 10:43:01 PDT 2009


Fri, 07 Aug 2009 12:50:25 +0200, Lars T. Kyllingstad thusly wrote:

> In the 'proposed syntax change' thread, Don mentioned that an
> exponentiation operator is sorely missing from D. I couldn't agree more.

> ...

> "Why do we need this?" you say. "Isn't pow(a,b) good enough?" And yes,
> pow(a,b) is just as good as mul(a,b) or div(a,b), but we don't use
> those, do we?

A lot of other built-in operators are missing. I'd like to add opGcd() 
(greatest common denominator), opFactorial (memoizing O(1) 
implementation, for advertising the terseness of D on reddit), opStar 
(has been discussed before), opSwap, opFold, opMap, and opFish (><>) to 
your list. Operations for paraconsistent logic would be nice, too. After 
all, these are operations I use quite often ==> everyone must need them 
badly.

> He also proposed that the overload be called opPower.
> 
> What do you think?

Sounds perfect.

> 
> -Lars




More information about the Digitalmars-d mailing list