problem with byLine

dcoder dcoder at nowhere.com
Tue May 15 11:54:50 PDT 2012


On Tuesday, 15 May 2012 at 16:03:16 UTC, Matt Soucy wrote:
>> I'm trying to learn D, by playing with code and reading this 
>> forum. I'm
>> a slow learner. :)
>>
>> Anyways, I looked at std.stdio code and noticed that byLine 
>> resturns a
>> struct ByLine, but where does the .map come from? Thanks!
>>
>
> It comes from std.algorithm. What that line does is:
> f.byLine() // Get by lines, exactly as you know already
> .map!"a.idup"() // Iterate over the byLine, and make a Range of 
> immutable strings with the same contents as each line.
> .array() // Convert it from a range to an array of strings
>
> This is achieved through templates accepting strings at compile 
> time to be somewhat like lambda functions, and UFCS.



Okay thanks alot Matt and Ali, that helps alot, but I still don't
get the dot in ".map" from the line above.  Doesn't the dot mean
that .map is a member or a member function of the return value of
byLine()?  Which, in this case is struct ByLine?

thanks.



More information about the Digitalmars-d-learn mailing list