[your code here]

Jose Armando Garcia jsancio at gmail.com
Fri Feb 17 12:45:53 PST 2012


On Fri, Feb 17, 2012 at 6:33 PM, Joshua Niehus <jm.niehus at gmail.com> 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));   }

Looks like Haskell to me. Granted that Haskell has syntactic sugar for
this that makes it more readable.

-Jose


More information about the Digitalmars-d mailing list