Re: confused about string and lambda args

2020-01-17 Thread mark via Digitalmars-d-learn
On Friday, 17 January 2020 at 07:57:16 UTC, mark wrote: On Thursday, 16 January 2020 at 17:11:11 UTC, Adam D. Ruppe wrote: [...] The string thing probably shouldn't be used anymore. I suggest you always use the => form instead. The string thing is a legacy version that was before the languag

Re: confused about string and lambda args

2020-01-17 Thread mark via Digitalmars-d-learn
On Thursday, 16 January 2020 at 17:11:11 UTC, Adam D. Ruppe wrote: [...] The string thing probably shouldn't be used anymore. I suggest you always use the => form instead. The string thing is a legacy version that was before the language had =>. [...] Thanks for that very clear explanation.

Re: confused about string and lambda args

2020-01-16 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jan 16, 2020 at 05:03:33PM +, mark via Digitalmars-d-learn wrote: [...] > auto wordCharCounts4 = words // I added this and it won't compile > .map!(a => a.count); // Error: no property count for type string > writeln(wordCharCounts4); You need to import std.algorithm to g

Re: confused about string and lambda args

2020-01-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 16 January 2020 at 17:03:33 UTC, mark wrote: auto wordCharCounts = words // I added this and it works fine .map!"a.length"; writeln(wordCharCounts); The string thing probably shouldn't be used anymore. I suggest you always use the => form instead. The string thi

confused about string and lambda args

2020-01-16 Thread mark via Digitalmars-d-learn
I'm looking at https://tour.dlang.org/tour/en/gems/range-algorithms (IMO the example code is far too long and complicated.) But here's the thing: auto wordCharCounts = words // I added this and it works fine .map!"a.length"; writeln(wordCharCounts); auto wordCharCounts2 = wo