A little challenge...

Jason House jason.james.house at gmail.com
Thu Feb 25 16:47:51 PST 2010


Norbert Nemec Wrote:

> Hi everybody,
> 
> thinking about array expressions, I have stumbled over an interesting 
> challenge for which I still have no idea:
> 
> Consider the mathematical sum notation:
> 
> 	\sum_i a_i*b_i
> 
> here, the variable i is defined only at the scope inside the expression.
> 
> A analogous D syntax could be something like
> 
> 	sum!(i)(a[i]*b[i])

Would sum!( "i", "a[i]*b[i]" ) be acceptable? That should be achievable with a template mixin that does string mixins under the hood.



More information about the Digitalmars-d mailing list