On Friday, 28 October 2016 at 13:50:24 UTC, Alfred Newman wrote:
On Friday, 28 October 2016 at 11:40:37 UTC, Chris wrote:
[...]
@Chris
As a new guy in the D community, I am not sure, but I think the
line below is something like a Python's lambda, right ?
auto removed = to!string(str.map!(a => (a in _accent) ?
_accent[a] : a));
Can you please rewrite the line in a more didatic way ? Sorry,
but I'm still learning the basics.
Thanks in advance
It boils down to something like:
if (c in _accent)
return _accent[c];
else
return c;
Just a normal lambda (condition true) ? yes : no;
I'd recommend you to use Marc's approach, though.