Idiotmatic D
Craig Dillabaugh
cdillaba at cg.scs.carleton.ca
Thu Feb 6 15:33:09 PST 2014
On Tuesday, 4 February 2014 at 23:05:40 UTC, Meta wrote:
> On Tuesday, 4 February 2014 at 22:53:30 UTC, Andrej Mitrovic
> wrote:
>> On 2/2/14, Brian Schott <briancschott at gmail.com> wrote:
>>> We all know how nice well-written idiomatic D code looks, but
>>> I
>>> think it's time that we try to really explore the full power
>>> of
>>> the language.
>>
>> D is the tersest language around, just observe how I can make
>> functions returning functions with ease:
>>
>> void main()
>> {
>> (() => (){})()();
>> }
>
> I call this one the Programmer's Hairbrush:
>
> void main()
> {
> (()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> ()=>
> (){}
> )
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ()
> ;
> }
>
> http://dpaste.dzfl.pl/490d5e6707f8
Hey, you can use this pattern to generate all sort of compilable
D-art (Sorry, I am kind of busy with work, or I would have come
up with something a bit nicer, but it does compile!
void main()
{
(() =>() =>()=> ()=>()=>()
=> ()=> ()=>()=> ()=> () =>
() => () => ()=>
() => () => ()=>
() => () => ()
{} ) () () ()
() () () () ()
() () () () ()
() () () ()( )( );
}
More information about the Digitalmars-d
mailing list