Re: problems with DPL example.

2012-03-13 Thread Shripad K
Boy its really hard to navigate this forum for an old thread. Seems like a lot has changed in D since this thread. Here is the correct snippet if someone comes searching for "error: undefined identifier splitter" like me :) (using DMD64 D Compiler v2.058) import std.stdio, std.string, std.algo

Re: problems with DPL example.

2011-10-12 Thread Steven Schveighoffer
On Mon, 10 Oct 2011 15:42:26 -0400, simendsjo wrote: On 10.10.2011 21:38, bearophile wrote: %u: D>echo hello | wordcount2.exe< wordcount2.d 0 hello std.stdio.StdioException@std\stdio.d(2156): Bad file descriptor This is a bug in the C runtime that D uses, where pipes are not used

Re: problems with DPL example.

2011-10-10 Thread Jonathan M Davis
You should checkout out this page: http://erdani.com/tdpl/errata/ - Jonathan M Davis

Re: problems with DPL example.

2011-10-10 Thread %u
== Quote from bearophile (bearophileh...@lycos.com)'s article > simendsjo: > > Shouldn't the original way work too? > I don't remember. > > Another point: I recommend compiling with debug symbols as it gives you > > a nice stacktrace. > I think debug symbols should be present on default, to produce

Re: problems with DPL example.

2011-10-10 Thread bearophile
simendsjo: > Shouldn't the original way work too? I don't remember. > Another point: I recommend compiling with debug symbols as it gives you > a nice stacktrace. I think debug symbols should be present on default, to produce a nice stack trace on default, and be disabled with a compiler sw

Re: problems with DPL example.

2011-10-10 Thread simendsjo
On 10.10.2011 21:38, bearophile wrote: %u: D>echo hello | wordcount2.exe< wordcount2.d 0 hello std.stdio.StdioException@std\stdio.d(2156): Bad file descriptor Try: wordcount2.exe< wordcount2.d Bye, bearophile Shouldn't the original way work too? Another point: I recommend compili

Re: problems with DPL example.

2011-10-10 Thread bearophile
%u: > D>echo hello | wordcount2.exe < wordcount2.d > 0 hello > std.stdio.StdioException@std\stdio.d(2156): Bad file descriptor Try: wordcount2.exe < wordcount2.d Bye, bearophile

Re: problems with DPL example.

2011-10-10 Thread %u
Thanks. It works, but I get something weird in the output. I get the problem if I run it in a dos prompt or in a cygwin prompt: Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. D>echo hello | wordcount2.exe 0 hello std.stdio.StdioExceptio

Re: problems with DPL example.

2011-10-10 Thread Justin Whear
You need to create an immutable copy of word before using it as a key. That is, replace this line: > dictionary[word] = newID; with dictionary[word.idup] = newID;

Re: problems with DPL example.

2011-10-10 Thread %u
== Quote from simendsjo (simend...@gmail.com)'s article > Seems some functionality was moved in 2.052. From std.string documentation: > "IMPORTANT NOTE: Beginning with version 2.052, the following symbols > have been generalized beyond strings and moved to different modules." > And > "split

Re: problems with DPL example.

2011-10-10 Thread simendsjo
On 10.10.2011 19:55, %u wrote: 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 wor

problems with DPL example.

2011-10-10 Thread %u
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