problems with DPL example.
%u
foo at bar.com
Mon Oct 10 10:55:00 PDT 2011
Hello. I'm having problems compiling the following:
// From chapter 1 of D Programming Language.
//
import std.stdio, std.string;
void main() {
uint[string] dictionary;
foreach( line; stdin.byLine()) {
// Break sentence into words
// Add each word in the sentence to the vocabulary
foreach( word; splitter(strip(line))) {
if( word in dictionary) continue; // Nothing to do.
auto newID = dictionary.length;
dictionary[word] = newID;
writeln( newid, '\t', word);
}
}
return;
}
$ dmd wordcount.d
wordcount.d(9): Error: undefined identifier splitter
$ dmd -v
DMD32 D Compiler v2.055
Copyright (c) 1999-2011 by Digital Mars written by Walter Bright
Documentation: http://www.digitalmars.com/d/2.0/index.html
I am doing the examples in cygwin.
Anyone know what the problem is?
thanks.
More information about the Digitalmars-d-learn
mailing list