a newbie problem regarding splitter()

alex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 12 23:33:56 PDT 2017


Hello,

I've just started learning D, working my way through "The D 
Programming Language" by Andrei Alexandrescu. On page 8 there is:
import std.stdio, std.string;

void main(){
     uint[string] dictionary;
     foreach (line; stdin.byLine()){
         foreach (word; splitter(strip(line))){
	    if (word in dictionary) continue;
  	    auto newID = dictionary.length;
	    dictionary[word] = newID;
	    writeln(newID, '\t', word);
	}
     }
}

When i try to run it, i get that splitter is 'undefined'. I can't 
spot the error. Maybe a fresh pair of eyes will do it??

Thank you,
Alex


More information about the Digitalmars-d-learn mailing list