[your code here]

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Feb 17 12:50:27 PST 2012


On 2/17/12 2:33 PM, Joshua Niehus wrote:
> Not as fancy as the other submits, but it might be worthy of the front
> page:
>
> import std.stdio, std.traits;
>
> void main(string[] args) {
> auto foo(T)(T n) {
> return delegate(T i) {
> static if (isSomeString!(T))
> auto m = mixin("n ~ i");
> else
> auto m = mixin("n + i");
> return m;
> };
> }
> writeln(foo("Hello")(" World!"));
> writeln(foo(18)(24)); }

Thanks. I have received a proposal in my inbox for rotating examples. 
Stay tuned.

Andrei


More information about the Digitalmars-d mailing list