On Fri, Feb 17, 2012 at 6:33 PM, Joshua Niehus <[email protected]> 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
