reddit.com: first Chapter of TDPL available for free
Sam Hu
samhudotsamhu at gmail.com
Tue Aug 4 04:56:57 PDT 2009
Sorry for my stepping in,but as a beginner in D ,I think maybe you( all of you experts) have interest to hear what he think after he read the book:This is really really great!Thank you so much for your great job!
Here a couple of questions regarding first chapter:
1.foreach (line; stdin.byLine) {
Did not mention how to read data from file *hamlet.txt* to the analyse.If I want to run the test case,I don't know how.
2. foreach (word; splitter(strip(line))) {
2.1 what's the purpose of splitter(strip(line)) ,I can guess a bit but not sure;
2.2 In the first place you used split,after that you use splitter;
3.string[] words = array(freqs.keys);
what's array? I can not find it from phobos,was I missing something?If yes,please forgive me.
4.sort!((a, b) { return freqs[a] > freqs[b]; })(words);
cann't get compiled under dmd 2.031.
5.abstract class IncrementalStat : Stat {...}
Why need this extra abstract class which derived from interface Stat?For class Max,Min and AVG,does't it work fine just implementing the Stat?For a beginner,it confused me a lot.I think it would be much better to explain more here.
At the very begining,I am typing while reading to test all the impressive examples,but very quicky I found I am lost starting at the point of my qestion#1-4.So finally I gave up to test the example,just read.This is my experience.
Thank you again and best regards,
Sam
More information about the Digitalmars-d
mailing list