domcode / rafflers

A collection of fun, funky, esoteric rafflers
26 stars 43 forks source link

Add raffler in D using chained UFCS #137

Closed arothuis closed 7 years ago

arothuis commented 7 years ago

D is an extensive language, but it can be simple.

Uniform Function Call Syntax allows for chaining functions in a neat, readable way. Whenever calling a function on a type, the compiler checks if the type has that method. If the type does not have said method, the compiler tries to apply a function that conforms to the signature using the type that is called upon as the first parameter and, if any, other arguments as remaining parameters.

Alternatively, your could add "import std.functional" and do one of the following functional looking one-liners:

lucasvanlierop commented 7 years ago

Heavy D