Chaining std.algorithm
H. S. Teoh
hsteoh at quickfur.ath.cx
Sun Dec 15 22:19:07 PST 2013
On Mon, Dec 16, 2013 at 05:42:10PM +1300, John Carter wrote:
[...]
> Now I'm sure I can use std.algorithm map to convert say a string of
> characters "IVXLCDM" into an array [1,5,10,50,100,500,1000]
>
> but somehow D template instantiation syntax is flumoxing me.
>
> When I try use find in map!"find!""" dmd whinges like crazy at me.
[...]
One thing to understand about the '!' syntax is that if the following
argument is more than one token, you should enclose it in parentheses
(and you might as well use full lambda syntax as well):
range.map!((x) => arr.find!(x));
T
--
What do you get if you drop a piano down a mineshaft? A flat minor.
More information about the Digitalmars-d-learn
mailing list