On 2011-08-24 19:40, Andrej Mitrovic wrote:
Here's what I can do with a variadic function:
void main()
{
int[] a = [ 1, 2, 4, 7, 7, 2, 4, 7, 3, 5];
process(a[a.countUntil(7) .. $]);
process(1);
}
void process(int[] vals...)
{
foreach (val; vals)
{
}
}
Very simple
On Thu, 25 Aug 2011 04:46:11 +, Cleem wrote:
> What libraries are linked by command dmd as linker? I want to use g++ as
> linker and link phobos2 and druntime libraries. But there are some
> undefined references, for example:
> _D3std4conv13ConvException7__ClassZ
> _D3std4conv16__T5parseTlTAya
On Thursday, August 25, 2011 04:46:11 Cleem wrote:
> What libraries are linked by command dmd as linker? I want to use g++
> as linker and link phobos2 and druntime libraries. But there are some
> undefined references, for example:
> _D3std4conv13ConvException7__ClassZ
> _D3std4conv16__T5parseTlTAy
On Mon, 15 Aug 2011 05:49:59 +0300, Andrej Mitrovic
wrote:
Is there something in Phobos with which I could do:
auto arr = [1, 2, 3, 4, 5, 6];
int[][] newarr = arr.splitLength(2);
assert(newarr.length == 3);
Almost but not quite: auto newarr = cast(int[2][])arr;
--
Best regards,
Vladimir
What libraries are linked by command dmd as linker? I want to use g++
as linker and link phobos2 and druntime libraries. But there are some
undefined references, for example:
_D3std4conv13ConvException7__ClassZ
_D3std4conv16__T5parseTlTAyaZ5parseFKAyaZl
_D3std5ascii7isDigitFNaNbNfwZb
_d_arraysetcap
On 08/25/2011 12:47 AM, Mafi wrote:
Am 24.08.2011 21:04, schrieb Timon Gehr:
On 08/24/2011 08:04 PM, Andrej Mitrovic wrote:
Here's some code that iterates through "parents" of some class object
until it finds an object with no parent (where parent is null):
import std.stdio;
class Foo
{
Foo p
Am 24.08.2011 21:04, schrieb Timon Gehr:
On 08/24/2011 08:04 PM, Andrej Mitrovic wrote:
Here's some code that iterates through "parents" of some class object
until it finds an object with no parent (where parent is null):
import std.stdio;
class Foo
{
Foo parent;
int state;
this (int state) {
Req'd: http://d.puremagic.com/issues/show_bug.cgi?id=6550
On 08/24/2011 09:36 PM, Jonathan M Davis wrote:
On Wednesday, August 24, 2011 21:29:23 Timon Gehr wrote:
On 08/24/2011 09:21 PM, Andrej Mitrovic wrote:
On 8/24/11, Timon Gehr wrote:
it is usually faster
in debug mode
Huh.. How come?
Well, not notably faster, but many compilers will emit
On Wednesday, August 24, 2011 21:29:23 Timon Gehr wrote:
> On 08/24/2011 09:21 PM, Andrej Mitrovic wrote:
> > On 8/24/11, Timon Gehr wrote:
> >> it is usually faster
> >> in debug mode
> >
> > Huh.. How come?
>
> Well, not notably faster, but many compilers will emit something in the
> lines of
On 08/24/2011 09:21 PM, Andrej Mitrovic wrote:
On 8/24/11, Timon Gehr wrote:
it is usually faster
in debug mode
Huh.. How come?
Well, not notably faster, but many compilers will emit something in the
lines of
mov eax, 1
test eax
jnz beginning_of_loop
if no optimizer is run,
whereas mos
On 8/24/11, Timon Gehr wrote:
> it is usually faster
> in debug mode
Huh.. How come?
On 08/24/2011 08:04 PM, Andrej Mitrovic wrote:
Here's some code that iterates through "parents" of some class object
until it finds an object with no parent (where parent is null):
import std.stdio;
class Foo
{
Foo parent;
int state;
this (int state) { this.state = state; }
}
v
On Wednesday, August 24, 2011 11:00 Timon Gehr wrote:
> On 08/24/2011 07:54 PM, Steven Schveighoffer wrote:
> > On Wed, 24 Aug 2011 13:40:38 -0400, Andrej Mitrovic
> >
> > wrote:
> >> Here's what I can do with a variadic function:
> >>
> >> void main()
> >> {
> >> int[] a = [ 1, 2, 4, 7, 7, 2, 4
Yeah, it should work with any level of nesting.
If toPrettyChars() doesn't work out, my parent
plan is actually more like:
auto item = this.parent;
while(item) {
str ~= "." ~ item.toChars();
item = this.parent;
}
so it'd go any level needed.
Brian Brady Wrote:
> but it just hangs there, not doing anything(for a considerable time) so I am
> assuming I am doing something wrong. There isn't any actual mention in the
> book of *how* reading in the text file should be accomplished, so what is the
> best way to do this?
Now that you know h
P.S. I'm aware I'm loosing the reference to the first foo object but
this is just demonstration code.
Den 23-08-2011 22:38, Adam D. Ruppe skrev:
Jonathan M Davis wrote:
I'm fairly certain that the anchors are generated by ddoc, not std.ddoc
Well, it's a bit of both.
DDOC_PSYMBOL =$(U $0)
Looking at doc.c, DDOC_PSYMBOL is used in the toDocBuffer() methods.
The paramater to it is always this.t
On 08/24/2011 07:54 PM, Steven Schveighoffer wrote:
On Wed, 24 Aug 2011 13:40:38 -0400, Andrej Mitrovic
wrote:
Here's what I can do with a variadic function:
void main()
{
int[] a = [ 1, 2, 4, 7, 7, 2, 4, 7, 3, 5];
process(a[a.countUntil(7) .. $]);
process(1);
}
void process(int[] vals...)
Here's some code that iterates through "parents" of some class object
until it finds an object with no parent (where parent is null):
import std.stdio;
class Foo
{
Foo parent;
int state;
this (int state) { this.state = state; }
}
void main()
{
auto foo = new Foo(0);
On Wed, 24 Aug 2011 13:40:38 -0400, Andrej Mitrovic
wrote:
Here's what I can do with a variadic function:
void main()
{
int[] a = [ 1, 2, 4, 7, 7, 2, 4, 7, 3, 5];
process(a[a.countUntil(7) .. $]);
process(1);
}
void process(int[] vals...)
{
foreach (val; vals)
{
}
}
On 08/24/2011 07:40 PM, Andrej Mitrovic wrote:
Here's what I can do with a variadic function:
void main()
{
int[] a = [ 1, 2, 4, 7, 7, 2, 4, 7, 3, 5];
process(a[a.countUntil(7) .. $]);
process(1);
}
void process(int[] vals...)
{
foreach (val; vals)
{
}
}
Very sim
Here's what I can do with a variadic function:
void main()
{
int[] a = [ 1, 2, 4, 7, 7, 2, 4, 7, 3, 5];
process(a[a.countUntil(7) .. $]);
process(1);
}
void process(int[] vals...)
{
foreach (val; vals)
{
}
}
Very simple, pass one or multiple arguments. But then I thought
The program reads the "file" from stdin, so you need to redirect stdin
to the file you want: try "./readingHamlet < hamlet.txt" or "cat
hamlet.txt | ./readingHamlet" without the quotes on a *NIX system.
---
Cristi Cobzarenco
BSc in Artificial Intelligence and Computer Science
University of Edinbur
> The default stdin doesn't have an end, and unless you type something
> in, there's no input at all. That's why the program just hangs.
You can end keyboard stdin by typing ^D (Ctrl + D) under unix.
On 2011-08-24 16:59, Andrej Mitrovic wrote:
class Foo
{
this(int x, int y) { }
}
class Bar : Foo
{
}
Bar has to define its own ctor even if it only forwards the call to
the super() ctor, e.g.:
class Bar : Foo
{
this(int x, int y) { super(x, y); }
}
But I'm curious why this works thi
On 8/24/11 12:27 PM, Ali Çehreli wrote:
On Wed, 24 Aug 2011 16:59:46 +0200, Andrej Mitrovic wrote:
class Foo
{
this(int x, int y) { }
}
class Bar : Foo
{
}
Bar has to define its own ctor even if it only forwards the call to the
super() ctor, e.g.:
class Bar : Foo
{
this(int x, int
On Wed, 24 Aug 2011 16:59:46 +0200, Andrej Mitrovic wrote:
> class Foo
> {
> this(int x, int y) { }
> }
>
> class Bar : Foo
> {
> }
>
> Bar has to define its own ctor even if it only forwards the call to the
> super() ctor, e.g.:
>
> class Bar : Foo
> {
> this(int x, int y) { super(x, y
class Foo
{
this(int x, int y) { }
}
class Bar : Foo
{
}
Bar has to define its own ctor even if it only forwards the call to
the super() ctor, e.g.:
class Bar : Foo
{
this(int x, int y) { super(x, y); }
}
But I'm curious why this works this way. If I have a large inheritance
tree of cla
Maybe ./readingHamlet < hamlet.txt
== Quote from Johannes Pfau (s...@example.com)'s article
> Brian Brady wrote:
> >All
> >
> >I am working through Andrei Alexandrescus "The D Programming Language"
> >but have hit a road block fairly early on.
> >
> >There is a program in the book which is designed to read through a
> >text file and
On Wed, 24 Aug 2011 10:25:18 -0400, Johannes Pfau wrote:
On Linux/unix you can for example pipe the output from one command to
another:
cat hamlet.txt | ./readingHamlet
this way readingHamlet's standard input is connected to cat's standard
output.
I believe in all OSes (Windows included) ./
Brian Brady wrote:
>All
>
>I am working through Andrei Alexandrescus "The D Programming Language"
>but have hit a road block fairly early on.
>
>There is a program in the book which is designed to read through a
>text file and do a simple word count. The program looks like this:
>
>import std.stdio
All
I am working through Andrei Alexandrescus "The D Programming Language" but
have hit a road block fairly early on.
There is a program in the book which is designed to read through a text file
and do a simple word count. The program looks like this:
import std.stdio, std.string;
void main()
{
Simen Kjaeraas wrote:
On Mon, 22 Aug 2011 22:19:50 +0200, Don wrote:
BTW: The whole "weak pure"/"strong pure" naming was just something I
came up with, to convince Walter to relax the purity rules. I'd rather
those names disappeared, they aren't very helpful.
The concepts are useful, but be
Adam D. Ruppe wrote:
>Jonathan M Davis wrote:
>> I'm fairly certain that the anchors are generated by ddoc, not
>> std.ddoc
>
>Well, it's a bit of both.
>
>DDOC_PSYMBOL = $(U $0)
>
>Looking at doc.c, DDOC_PSYMBOL is used in the toDocBuffer() methods.
>The paramater to it is always this.toChars().
>
36 matches
Mail list logo