Re: Problems with stdio.byLine() in D Book

2010-12-16 Thread Andrej Mitrovic
Don't forget to bookmark the errata page: http://erdani.com/tdpl/errata/index.php?title=Main_Page ;) On 12/16/10, Chris A wrote: > Hmm... maybe my compiler was out of date. I downloaded DMD again and tried > your code, and it seems to build fine now. > > Sorry for the trouble then, thank you for

Re: Problems with stdio.byLine() in D Book

2010-12-16 Thread Chris A
Hmm... maybe my compiler was out of date. I downloaded DMD again and tried your code, and it seems to build fine now. Sorry for the trouble then, thank you for setting me on the right path Andrej. Andrej Mitrovic Wrote: > This works fine for me: > > import std.stdio; > import std.string;

Re: Problems with stdio.byLine() in D Book

2010-12-16 Thread Andrej Mitrovic
This works fine for me: import std.stdio; import std.string; void main(string[] args) { uint[string] freqs; foreach(lines; stdin.byLine()) { foreach(word; split(strip(lines))) { ++freqs[word.idup]; } } foreach(key, v

Problems with stdio.byLine() in D Book

2010-12-16 Thread Chris A
Hey all, I'm going over some examples in Alexandrescu's book, but I guess something has changed in the language because the example isn't working for me. The simple example: void main(string[] args) { uint[string] freqs; foreach(lines; stdin.byLine()) { foreach(wo

Re: List of derived types?

2010-12-16 Thread d coder
> I'm curious, why do you need that? > It is a long story. But basically I am creating a platform wherein the users would be deriving classes from some base classes that I write as part of the platform. And the users would often be deriving many such classes. The end-users would often not be pro

Re: List of derived types?

2010-12-16 Thread Simen kjaeraas
d coder wrote: Greetings I need a way to know (using traits or other compile time constructs) all the types derived from a given type. Is it possible in D? No. Is it possible to get a list of all the user-defined classes? I could use that to filter out the classes that I need. No. Howe

Re: List of derived types?

2010-12-16 Thread Pelle MÃ¥nsson
On 12/16/2010 02:16 PM, d coder wrote: Greetings I need a way to know (using traits or other compile time constructs) all the types derived from a given type. Is it possible in D? Is it possible to get a list of all the user-defined classes? I could use that to filter out the classes that I nee

Re: List of derived types?

2010-12-16 Thread Michal Minich
V Thu, 16 Dec 2010 18:46:41 +0530, d coder wrote: > Greetings > > I need a way to know (using traits or other compile time constructs) all > the types derived from a given type. Is it possible in D? > > Is it possible to get a list of all the user-defined classes? I could > use that to filter ou

List of derived types?

2010-12-16 Thread d coder
Greetings I need a way to know (using traits or other compile time constructs) all the types derived from a given type. Is it possible in D? Is it possible to get a list of all the user-defined classes? I could use that to filter out the classes that I need. Regards Cherry

Re: Why does this floating point comparison fail?

2010-12-16 Thread Don
Jonathan M Davis wrote: Maybe I'm just totally missing something, but this seems really wrong to me. This program: import std.stdio; void main() { writeln(2.1); writeln(2.1 == 2.1); writeln(3 * .7); writeln(2.1 == 3 * .7); auto a = 2.1; auto b = 3 * .7; writeln(a);

Why does this floating point comparison fail?

2010-12-16 Thread Jonathan M Davis
Maybe I'm just totally missing something, but this seems really wrong to me. This program: import std.stdio; void main() { writeln(2.1); writeln(2.1 == 2.1); writeln(3 * .7); writeln(2.1 == 3 * .7); auto a = 2.1; auto b = 3 * .7; writeln(a); writeln(b); write