On Wednesday, 4 July 2012 at 05:15:20 UTC, mezozoysky wrote:
On Tuesday, 26 June 2012 at 10:23:32 UTC, Jacob Carlborg wrote:
On 2012-06-26 10:45, mezozoysky wrote:
Hello!
I'm not sure if this is the right thread for this question.
If you know
in which thread this question should be, please poi
On Tuesday, 26 June 2012 at 10:23:32 UTC, Jacob Carlborg wrote:
On 2012-06-26 10:45, mezozoysky wrote:
Hello!
I'm not sure if this is the right thread for this question. If
you know
in which thread this question should be, please point me to it.
I've see a strange things using dmd 2.059 with
On Wednesday, 4 July 2012 at 01:53:40 UTC, Jonathan M Davis wrote:
On Wednesday, July 04, 2012 03:48:52 ixid wrote:
> 0.writeln();
>
> This works.
It doesn't with 2.058, are we using different versions? Thanks
for adding it to the bug list, I am not knowledgeable enough
about D to judge if so
I think I'm using 2.059 actually.
On Wednesday, July 04, 2012 03:48:52 ixid wrote:
> > 0.writeln();
> >
> > This works.
>
> It doesn't with 2.058, are we using different versions? Thanks
> for adding it to the bug list, I am not knowledgeable enough
> about D to judge if something is a bug or if I've just not
> understood it.
2.
0.writeln();
This works.
It doesn't with 2.058, are we using different versions? Thanks
for adding it to the bug list, I am not knowledgeable enough
about D to judge if something is a bug or if I've just not
understood it.
On Tuesday, July 03, 2012 17:34:21 Jonathan M Davis wrote:
> On Wednesday, July 04, 2012 02:20:26 ixid wrote:
> > 0.writeln();
>
> This works.
>
> > 01.writeln();
>
> This doesn't.
>
> > etc...
> >
> > Throw up a series of errors while any other number as the leading
> > digit seems to work fi
On Wednesday, July 04, 2012 02:20:26 ixid wrote:
> 0.writeln();
This works.
> 01.writeln();
This doesn't.
> etc...
>
> Throw up a series of errors while any other number as the leading
> digit seems to work fine. Why is this?
It's probably an artifact of getting rid of octal literals and is c
0.writeln();
01.writeln();
etc...
Throw up a series of errors while any other number as the leading
digit seems to work fine. Why is this?
Ok, everything works great now.
thank you
maarten
maarten van damme:
Now I get a variable with the Result type and this isn't
castable or convertable to an array of strings,
Right, sorry. (If I don't run the code I show, then it's usually
broken in some way).
how can I extract the actual result now?
Often you don't need an array, a laz
Ok, that made sense :)
Now I get a variable with the Result type and this isn't castable or
convertable to an array of strings, how can I extract the actual
result now?
maarten van damme:
string [] added=map!("toName(a,parsedschema)")(mod.added);
Try with a lambda:
string[] added = mod.added.map!(x => toName(x, parsedschema))();
Bye,
bearophile
On Tue, Jul 3, 2012 at 8:58 PM, maarten van damme
wrote:
> I have an array of structs and I've written a function that takes as
> argument a struct (and an array but this is besides the point) and
> returns a unique string.
It's not beside the point, I think it's the exact cause of your problem
On Tuesday, 3 July 2012 at 18:39:09 UTC, Artur Skawina wrote:
On 07/03/12 20:30, Tobias Pankrath wrote:
Is it possible to redirect stdout in a way that all following
calls to
writeln etc just write to /dev/null or something similar?
stdout.open(outfilename, "wt");
artur
Thank you. After
"Tobias Pankrath" writes:
> Is it possible to redirect stdout in a way that all following calls to
> writeln etc just write to /dev/null or something similar?
If it's any form of unix, all you need to do is close(1). If you still
need the fd afterwards, you want to use dup() first so you can res
I have an array of structs and I've written a function that takes as
argument a struct (and an array but this is besides the point) and
returns a unique string.
I wanted to use map to retrieve a string array of all unique strings
from that array. I've used it this way:
string [] added=map!("toNam
On Tuesday, 3 July 2012 at 18:30:41 UTC, Tobias Pankrath wrote:
Is it possible to redirect stdout in a way that all following
calls to
writeln etc just write to /dev/null or something similar?
Thanks!
And I need to restore them afterwards.
On 07/03/12 20:30, Tobias Pankrath wrote:
> Is it possible to redirect stdout in a way that all following calls to
> writeln etc just write to /dev/null or something similar?
stdout.open(outfilename, "wt");
artur
Is it possible to redirect stdout in a way that all following
calls to
writeln etc just write to /dev/null or something similar?
Thanks!
"nazriel" writes:
> Try this - http://dpaste.dzfl.pl/3efd9c1b
Yes, that's exactly what I need. Thanks.
Looks like I was making it far too difficult for myself :-)
--
The volume of a pizza of thickness a and radius z can be described by
the following formula:
pi zz a
Mike Parker writes:
> On 7/3/2012 12:12 PM, Wouter Verhelst wrote:
>>
>> So, I wanted to create a number of functions that would call write(),
>> writef(), writefln(), or writeln() with whatever arguments they were
>> given, but only if the user had used a 'enable debugging' command-line
>> optio
On Tuesday, 3 July 2012 at 17:25:18 UTC, bearophile wrote:
ixid:
In any case with large values of k the branch prediction will
be right almost all of the time, explaining why this form is
faster than modulo as modulo is fairly slow while this is a
correctly predicted branch doing an addition
ixid:
In any case with large values of k the branch prediction will
be right almost all of the time, explaining why this form is
faster than modulo as modulo is fairly slow while this is a
correctly predicted branch doing an addition if it doesn't make
it branchless.
That seems the explanat
Oops! I have a bad habit of thinking of the power operator as a
part of the value rather than as an operator.
ixid:
I take your point but I think most people know that the equals
operators have the lowest associativity.
Sorry I meant:
nums[iter_next] = total % (10 ^^ 8);
Instead of:
nums[iter_next] = total % 10^^8;
But I presume lot of people know that powers are higher
precedence :-)
Bye,
bearop
In any case with large values of k the branch prediction will be
right almost all of the time, explaining why this form is faster
than modulo as modulo is fairly slow while this is a correctly
predicted branch doing an addition if it doesn't make it
branchless. The branchless version gives the
I tested that, modulus is slower. The compiler is surely
converting it to something branchless like:
uint iter_next = (iter + 1) * !(iter + 1 > k);
I take your point but I think most people know that the equals
operators have the lowest associativity.
This is becoming a "fixed size circular queue". But maybe a
modulus is faster than a branch here.
I have tried, and it's slower both in D and C. I don't know why.
#include
#include
#include
uint64_t hFib(const uint32_t k, const uint32_t n) {
uint64_t *nums = calloc(k + 1, sizeof(uint64
ixid:
int iter_next = iter + 1 > k? 0 : iter + 1;
This is becoming a "fixed size circular queue". But maybe a
modulus is faster than a branch here. (It's better when k is
always a power of two, you don't need a modulus. And even better
if your size is a multiple of the page size
Thank you, that was faster. I decided to try the obvious method
of reusing the same array giving similar speed to your suggestion
while using less memory:
ulong f2(int k, int n) {
auto nums = new ulong[k + 1];
nums[$ - 1] = 1;
int iter = k;
ulong total = 0;
On Tuesday, July 03, 2012 15:29:51 bearophile wrote:
> ixid:
> > Given popFront is advancing a range does this mean the
> > underlying array is not being deleted? How would one delete the
> > information you don't need any more if so?
>
> I think the GC can't deallocate part of an array. It's a si
ixid:
It's a pity that the D standard library seems to lack rather a
lot of these things.
I've taken a better look at your code, for this program a deque
wasn't so needed.
This is quick:
import std.stdio;
ulong hFib(in uint k, in uint n) pure nothrow {
auto nums = new ulong[k + n + 1];
It's a pity that the D standard library seems to lack rather a
lot of these things. Permutation functions are also an annoying
one not to have. =/
ixid:
Given popFront is advancing a range does this mean the
underlying array is not being deleted? How would one delete the
information you don't need any more if so?
I think the GC can't deallocate part of an array. It's a single
memory zone, and it has to go all at once.
Maybe you need
That fixed the memory behaviour and is faster. Not using popFront
at all uses the same memory and is faster still. Given popFront
is advancing a range does this mean the underlying array is not
being deleted? How would one delete the information you don't
need any more if so?
On Tuesday, 3 July 2012 at 10:23:06 UTC, Mike Parker wrote:
On 7/3/2012 11:34 AM, Dustin wrote:
Hello,
I'm trying to follow along with a C++ tutorial and translate
it to D but
I don't know C/C++ well enough to understand this #Define
statement:
#define ARRAY_COUNT( array ) (sizeof( array ) /
On 7/3/2012 12:12 PM, Wouter Verhelst wrote:
So, I wanted to create a number of functions that would call write(),
writef(), writefln(), or writeln() with whatever arguments they were
given, but only if the user had used a 'enable debugging' command-line
option (or some such).
What I first did
On 7/3/2012 11:34 AM, Dustin wrote:
Hello,
I'm trying to follow along with a C++ tutorial and translate it to D but
I don't know C/C++ well enough to understand this #Define statement:
#define ARRAY_COUNT( array ) (sizeof( array ) / (sizeof( array[0] ) *
(sizeof( array ) != sizeof(void*) || size
On Tuesday, 3 July 2012 at 04:09:22 UTC, nazriel wrote:
On Tuesday, 3 July 2012 at 02:34:04 UTC, Dustin wrote:
Hello,
I'm trying to follow along with a C++ tutorial and translate
it to D but I don't know C/C++ well enough to understand this
#Define statement:
#define ARRAY_COUNT( array ) (si
On Tuesday, 3 July 2012 at 02:34:04 UTC, Dustin wrote:
Hello,
I'm trying to follow along with a C++ tutorial and translate it
to D but I don't know C/C++ well enough to understand this
#Define statement:
#define ARRAY_COUNT( array ) (sizeof( array ) / (sizeof(
array[0] ) * (sizeof( array ) !
41 matches
Mail list logo