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
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
You should checkout out this page: http://erdani.com/tdpl/errata/
- Jonathan M Davis
== Quote from bearophile ([email protected])'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
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
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
%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
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
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;
== Quote from simendsjo ([email protected])'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
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
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
12 matches
Mail list logo