On 08/26/2011 05:45 AM, Joel Christensen wrote:
Hi,
Has anyone had much experience with multiple subtyping.
//Org: based on page 232 (6.13.1) in The D Programming Language book
//#save(); without storeShape does not work
import std.stdio;
class Shape {
void shape() {
writeln( "Shape" );
}
}
c
On 08/26/2011 06:12 AM, Joel Christensen wrote:
On 26-Aug-11 10:20 AM, Timon Gehr wrote:
On 08/26/2011 12:19 AM, Timon Gehr wrote:
On 08/25/2011 11:34 PM, bellinom wrote:
whoops, this is better:
auto arr=to!(int[])(split(strip!(readln(;
Or,
auto arr2=to!(int[])( readln.strip.split );
On 26-Aug-11 10:20 AM, Timon Gehr wrote:
On 08/26/2011 12:19 AM, Timon Gehr wrote:
On 08/25/2011 11:34 PM, bellinom wrote:
whoops, this is better:
auto arr=to!(int[])(split(strip!(readln(;
Or,
auto arr2=to!(int[])( readln.strip.split );
Got rid of the second ! too (does not work with i
Hi,
Has anyone had much experience with multiple subtyping.
//Org: based on page 232 (6.13.1) in The D Programming Language book
//#save(); without storeShape does not work
import std.stdio;
class Shape {
void shape() {
writeln( "Shape" );
}
}
class DataBase {
On 08/26/2011 02:00 AM, Ali Çehreli wrote:
On Thu, 25 Aug 2011 23:31:26 +0200, Timon Gehr wrote:
for(init; condition; statement){}
while(condition ){}
That's a very interesting way of looking at the question.
I bet that explains the other way around: there can't be a variable
d
On Thu, 25 Aug 2011 23:31:26 +0200, Timon Gehr wrote:
> for(init; condition; statement){}
> while(condition ){}
That's a very interesting way of looking at the question.
I bet that explains the other way around: there can't be a variable
definition in the 'for' loop's condition cl
On 08/26/2011 12:38 AM, Steven Schveighoffer wrote:
On Thu, 25 Aug 2011 17:31:26 -0400, Timon Gehr wrote:
On 08/25/2011 10:51 PM, Steven Schveighoffer wrote:
> On Thu, 25 Aug 2011 12:21:19 -0400, Timon Gehr
wrote:
>
>
>>
>> I usually replace code like this:
>>
>> x++;
>> if(x < 100)
>> {
>> /
On Thu, 25 Aug 2011 17:31:26 -0400, Timon Gehr wrote:
On 08/25/2011 10:51 PM, Steven Schveighoffer wrote:
> On Thu, 25 Aug 2011 12:21:19 -0400, Timon Gehr
wrote:
>
>
>>
>> I usually replace code like this:
>>
>> x++;
>> if(x < 100)
>> {
>> // use x
>> }
>>
>> with this:
>>
>>
On 08/26/2011 12:19 AM, Timon Gehr wrote:
On 08/25/2011 11:34 PM, bellinom wrote:
> Thanks for that, I didn't realize they were that far out of date. I
use the latest
> version of the compiler on my home PC, so I'd like to know the most
current ways
> of reading from stdin.
>
> Thanks
Curre
On 08/25/2011 11:34 PM, bellinom wrote:
> Thanks for that, I didn't realize they were that far out of date. I
use the latest
> version of the compiler on my home PC, so I'd like to know the most
current ways
> of reading from stdin.
>
> Thanks
Currently what you get is readf and readln with st
On Thursday, August 25, 2011 14:34 bellinom wrote:
> Thanks for that, I didn't realize they were that far out of date. I use the
> latest version of the compiler on my home PC, so I'd like to know the most
> current ways of reading from stdin.
That's probably not something that has changed, but ma
A nifty way of reading by byte is
Of course I mean by character.
I'd like to know how to read from stdin one character at a time, read
with whitespace as a delimiter, and read line by line.
A nifty way of reading by byte is the undocumented (only the writer is
documented):
import std.stdio;
void main()
{
foreach(c; LockingTextReader(stdin))
.
On 08/25/2011 10:51 PM, Steven Schveighoffer wrote:
> On Thu, 25 Aug 2011 12:21:19 -0400, Timon Gehr wrote:
>
>
>>
>> I usually replace code like this:
>>
>> x++;
>> if(x < 100)
>> {
>> // use x
>> }
>>
>> with this:
>>
>> if(++x < 100) {
>> // use x
>> }
>>
>> so the logical mapping to while wou
Thanks for that, I didn't realize they were that far out of date. I use the
latest
version of the compiler on my home PC, so I'd like to know the most current ways
of reading from stdin.
Thanks
On Thu, 25 Aug 2011 12:21:19 -0400, Timon Gehr wrote:
I usually replace code like this:
x++;
if(x < 100)
{
// use x
}
with this:
if(++x < 100) {
// use x
}
so the logical mapping to while would map this:
x++;
while(x < 100)
{
// use x.
}
to this:
while(++x < 100) {
//
Yeap, it's definitely a bug, and the temp file is in fact the library
that I need.
Anyway I'm trying to compile it on Windows now. However, there are two
problems. First of all, the Windows Command Prompt does not expand
wildcards, and DMD does not take it as an argument. Thus importing
LuaD as a
On Thursday, August 25, 2011 11:38 Nick Sabalausky wrote:
> "Jacob Carlborg" wrote in message
> news:j2qn7n$1db7$1...@digitalmars.com...
>
> > On 2011-08-21 02:26, Jonathan M Davis wrote:
> >> The short answer: You don't. It's an incredibly bad idea.
> >>
> >> The long answer: You catch Error -
"Jacob Carlborg" wrote in message
news:j2qn7n$1db7$1...@digitalmars.com...
> On 2011-08-21 02:26, Jonathan M Davis wrote:
>>
>> The short answer: You don't. It's an incredibly bad idea.
>>
>> The long answer: You catch Error - or OutOfMemoryError if you want that
>> specific one. So, you could tr
On Thursday, August 25, 2011 10:49 bellinom wrote:
> Hello,
>
> I'm in the process of learning D, and I have some questions about reading
> from stdin. I've checked out the documentation but it's really not helping
> too much. I'd like to know how to read from stdin one character at a time,
> read
Hello,
I'm in the process of learning D, and I have some questions about reading from
stdin. I've checked out the documentation but it's really not helping too
much. I'd like to know how to read from stdin one character at a time, read
with whitespace as a delimiter, and read line by line. Essenti
On 08/25/2011 05:31 PM, Steven Schveighoffer wrote:
> On Thu, 25 Aug 2011 11:15:44 -0400, Jonathan M Davis
> wrote:
>
>> On Thursday, August 25, 2011 07:11:31 Steven Schveighoffer wrote:
>>> > On 08/25/2011 12:47 AM, Mafi wrote:
>
>>> >> I'm not really sure if it's good for 'while'.
>>> >> I'm un
On Thursday, August 25, 2011 11:31:56 Steven Schveighoffer wrote:
> On Thu, 25 Aug 2011 11:15:44 -0400, Jonathan M Davis
>
> wrote:
> > On Thursday, August 25, 2011 07:11:31 Steven Schveighoffer wrote:
> >> > On 08/25/2011 12:47 AM, Mafi wrote:
> >> >> I'm not really sure if it's good for 'while'
On Thu, 25 Aug 2011 11:15:44 -0400, Jonathan M Davis
wrote:
On Thursday, August 25, 2011 07:11:31 Steven Schveighoffer wrote:
> On 08/25/2011 12:47 AM, Mafi wrote:
>> I'm not really sure if it's good for 'while'.
>> I'm unsure because there are two somewhat natural semantics for such
a
On Thursday, August 25, 2011 07:11:31 Steven Schveighoffer wrote:
> On Wed, 24 Aug 2011 19:01:31 -0400, Timon Gehr wrote:
> > 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
On 08/25/2011 01:11 PM, Steven Schveighoffer wrote:
On Wed, 24 Aug 2011 19:01:31 -0400, Timon Gehr wrote:
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 clas
Christophe Wrote:
> > Still, is the multi-dimensional part possible?
>
> Sure, you have to make an opApply that takes several parameters in its
> delegate.
> An exemple:
>
> struct TwoDArray(int nx, int ny)
> {
> int[nx][ny] data;
>
> int opApply(int delegate(ref int i, ref int j, ref int
On Wed, 24 Aug 2011 19:01:31 -0400, Timon Gehr wrote:
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 (whe
> Still, is the multi-dimensional part possible?
Sure, you have to make an opApply that takes several parameters in its
delegate.
An exemple:
struct TwoDArray(int nx, int ny)
{
int[nx][ny] data;
int opApply(int delegate(ref int i, ref int j, ref int cell)
{
foreach (i; 0..nx)
Heywood Floyd Wrote:
>
> Hello!
>
> 1) How do I create a struct that I can foreach over?
>
> I get the impression opApply has something do to with this, but I can't find
> any documentation on it? (And I'm abroad without my TDPL.)
>
>
> 2) Also, is it possible to do something like this?
>
Hello!
1) How do I create a struct that I can foreach over?
I get the impression opApply has something do to with this, but I can't find
any documentation on it? (And I'm abroad without my TDPL.)
2) Also, is it possible to do something like this?
MyData!(100,100,100) data;
foreach(x, y,
31 matches
Mail list logo