On 2011-09-23 18:05, Simen Kjaeraas wrote:
On Thu, 22 Sep 2011 11:22:10 +0200, Jacob Carlborg <[email protected]> wrote:
auto newrange = filter!"a<5"(map!"2*a"(range));
At first some people get the heebiejeebies when seeing string-based
lambda and the implicit naming convention for unary and binary
functions. More importantly, there's the disadvantage you can't access
local functions inside a string lambda. We should probably add a
specialized lambda syntax.
I like this syntax:
auto newRange = range.map(a => 2 * a).filter(a => a < 5);
I dislike this syntax, in that it seems to pass the delegates as normal
function parameters, rather than template parameters.
New version:
auto newRange = range.map!(a => 2 * a).filter!(a => a < 5);
The important thing here was the lambda syntax, not if it's passed as a
template parameter or a regular parameter.
--
/Jacob Carlborg